mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-16 13:00:40 +00:00
* feat: cache each uncompressed page * chore: remove unused function * chore: log * chore: log * chore: row group pages cache kv * feat: also support row group level cache * chore: fix range count * feat: don't cache compressed page for row group cache * feat: use function to get part * chore: log whether scan is from compaction * chore: avoid get column * feat: add timer metrics * chore: Revert "feat: add timer metrics" This reverts commit 4618f57fa2ba13b1e1a8dec83afd01c00ae4c867. * feat: don't cache individual uncompressed page * feat: append in row group level under append mode Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * chore: fetch pages cost * perf: yield * Update src/mito2/src/sst/parquet/row_group.rs * refactor: cache key * feat: print file num and row groups num in explain * test: update sqlness test * chore: Update src/mito2/src/sst/parquet/page_reader.rs --------- Signed-off-by: Ruihang Xia <waynestxia@gmail.com> Co-authored-by: Ruihang Xia <waynestxia@gmail.com>
89 lines
2.8 KiB
Plaintext
89 lines
2.8 KiB
Plaintext
CREATE TABLE host (
|
|
ts timestamp(3) time index,
|
|
host STRING PRIMARY KEY,
|
|
val BIGINT,
|
|
);
|
|
|
|
Affected Rows: 0
|
|
|
|
INSERT INTO TABLE host VALUES
|
|
(0, 'host1', 0),
|
|
(5000, 'host1', null),
|
|
(10000, 'host1', 1),
|
|
(15000, 'host1', null),
|
|
(20000, 'host1', 2),
|
|
(0, 'host2', 3),
|
|
(5000, 'host2', null),
|
|
(10000, 'host2', 4),
|
|
(15000, 'host2', null),
|
|
(20000, 'host2', 5);
|
|
|
|
Affected Rows: 10
|
|
|
|
-- Test range query in nest sql
|
|
SELECT ts, host, foo FROM (SELECT ts, host, min(val) RANGE '5s' AS foo FROM host ALIGN '5s') WHERE host = 'host1' ORDER BY host, ts;
|
|
|
|
+---------------------+-------+-----+
|
|
| ts | host | foo |
|
|
+---------------------+-------+-----+
|
|
| 1970-01-01T00:00:00 | host1 | 0 |
|
|
| 1970-01-01T00:00:05 | host1 | |
|
|
| 1970-01-01T00:00:10 | host1 | 1 |
|
|
| 1970-01-01T00:00:15 | host1 | |
|
|
| 1970-01-01T00:00:20 | host1 | 2 |
|
|
+---------------------+-------+-----+
|
|
|
|
SELECT ts, b, min(c) RANGE '5s' FROM (SELECT ts, host AS b, val AS c FROM host WHERE host = 'host1') ALIGN '5s' BY (b) ORDER BY b, ts;
|
|
|
|
+---------------------+-------+-----------------+
|
|
| ts | b | MIN(c) RANGE 5s |
|
|
+---------------------+-------+-----------------+
|
|
| 1970-01-01T00:00:00 | host1 | 0 |
|
|
| 1970-01-01T00:00:05 | host1 | |
|
|
| 1970-01-01T00:00:10 | host1 | 1 |
|
|
| 1970-01-01T00:00:15 | host1 | |
|
|
| 1970-01-01T00:00:20 | host1 | 2 |
|
|
+---------------------+-------+-----------------+
|
|
|
|
-- Test EXPLAIN and ANALYZE
|
|
-- SQLNESS REPLACE (-+) -
|
|
-- SQLNESS REPLACE (\s\s+) _
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
-- SQLNESS REPLACE (metrics.*) REDACTED
|
|
EXPLAIN SELECT ts, host, min(val) RANGE '5s' FROM host ALIGN '5s';
|
|
|
|
+-+-+
|
|
| plan_type_| plan_|
|
|
+-+-+
|
|
| logical_plan_| RangeSelect: range_exprs=[MIN(host.val) RANGE 5s], align=5000ms, align_to=0ms, align_by=[host.host], time_index=ts |
|
|
|_|_MergeScan [is_placeholder=false]_|
|
|
| physical_plan | RangeSelectExec: range_expr=[MIN(host.val) RANGE 5s], align=5000ms, align_to=0ms, align_by=[host@1], time_index=ts |
|
|
|_|_CoalescePartitionsExec_|
|
|
|_|_MergeScanExec: REDACTED
|
|
|_|_|
|
|
+-+-+
|
|
|
|
-- SQLNESS REPLACE (-+) -
|
|
-- SQLNESS REPLACE (\s\s+) _
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
-- SQLNESS REPLACE (metrics.*) REDACTED
|
|
-- SQLNESS REPLACE region=\d+\(\d+,\s+\d+\) region=REDACTED
|
|
EXPLAIN ANALYZE SELECT ts, host, min(val) RANGE '5s' FROM host ALIGN '5s';
|
|
|
|
+-+-+-+
|
|
| stage | node | plan_|
|
|
+-+-+-+
|
|
| 0_| 0_|_RangeSelectExec: range_expr=[MIN(host.val) RANGE 5s], align=5000ms, align_to=0ms, align_by=[host@1], time_index=ts REDACTED
|
|
|_|_|_CoalescePartitionsExec REDACTED
|
|
|_|_|_MergeScanExec: REDACTED
|
|
|_|_|_|
|
|
| 1_| 0_|_SeqScan: region=REDACTED, partition_count=1 (1 memtable ranges, 0 file 0 ranges) REDACTED
|
|
|_|_|_|
|
|
|_|_| Total rows: 10_|
|
|
+-+-+-+
|
|
|
|
DROP TABLE host;
|
|
|
|
Affected Rows: 0
|
|
|