mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-06 21:32:58 +00:00
* chore: basic methods for SeriesScan
* chore: add to scanner enum
* feat: implement scan logic of each partition
* feat: use series scan when distribution is PerSeries
* refactor: remove per series scan from SeqScan
* fix: use series scan in PerSeries distribution
* feat: keep parallelize_scan unchanged
* fix: address compiler errors
* fix: include build merge reader cost to scan cost
* feat: use smallvec
* chore: update comment
* Revert "feat: keep parallelize_scan unchanged"
This reverts commit 96ba00d175.
* assign partition_ranges
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
* feat: try send before send
reduce the send timeout to 10ms
* chore: add comments
* fix: add metrics to partition metrics list
* fix: correct scan cost metrics
* chore: reset instant
* fix: scanner metrics init
* chore: display more info in explain
* feat: metrics for send series timeout
* style: fix clippy
* refactor: use ChainedRecordBatchStream to simplify codes
* chore: fix typos
* feat: separate distributor metrics
* feat: remove parallelize hack
* chore: fix warning
* test: add test for series scan
* test: update sqlness test
---------
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Co-authored-by: Ruihang Xia <waynestxia@gmail.com>
170 lines
6.6 KiB
Plaintext
170 lines
6.6 KiB
Plaintext
CREATE TABLE test(i DOUBLE, j TIMESTAMP TIME INDEX, k STRING PRIMARY KEY);
|
|
|
|
Affected Rows: 0
|
|
|
|
-- insert two points at 1ms and one point at 2ms
|
|
INSERT INTO test VALUES (1, 1, "a"), (1, 1, "b"), (2, 2, "a");
|
|
|
|
Affected Rows: 3
|
|
|
|
-- analyze at 0s, 5s and 10s. No point at 0s.
|
|
-- SQLNESS REPLACE (metrics.*) REDACTED
|
|
-- SQLNESS REPLACE (RoundRobinBatch.*) REDACTED
|
|
-- SQLNESS REPLACE (-+) -
|
|
-- SQLNESS REPLACE (\s\s+) _
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
-- SQLNESS REPLACE region=\d+\(\d+,\s+\d+\) region=REDACTED
|
|
TQL ANALYZE (0, 10, '5s') test;
|
|
|
|
+-+-+-+
|
|
| stage | node | plan_|
|
|
+-+-+-+
|
|
| 0_| 0_|_MergeScanExec: REDACTED
|
|
|_|_|_|
|
|
| 1_| 0_|_PromInstantManipulateExec: range=[0..10000], lookback=[300000], interval=[5000], time index=[j] REDACTED
|
|
|_|_|_PromSeriesDivideExec: tags=["k"] REDACTED
|
|
|_|_|_SeriesScan: region=REDACTED, partition_count=1 (1 memtable ranges, 0 file 0 ranges), distribution=PerSeries REDACTED
|
|
|_|_|_|
|
|
|_|_| Total rows: 4_|
|
|
+-+-+-+
|
|
|
|
-- 'lookback' parameter is not fully supported, the test has to be updated
|
|
-- analyze at 0s, 5s and 10s. No point at 0s.
|
|
-- SQLNESS REPLACE (metrics.*) REDACTED
|
|
-- SQLNESS REPLACE (RoundRobinBatch.*) REDACTED
|
|
-- SQLNESS REPLACE (-+) -
|
|
-- SQLNESS REPLACE (\s\s+) _
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
-- SQLNESS REPLACE region=\d+\(\d+,\s+\d+\) region=REDACTED
|
|
TQL ANALYZE (0, 10, '1s', '2s') test;
|
|
|
|
+-+-+-+
|
|
| stage | node | plan_|
|
|
+-+-+-+
|
|
| 0_| 0_|_MergeScanExec: REDACTED
|
|
|_|_|_|
|
|
| 1_| 0_|_PromInstantManipulateExec: range=[0..10000], lookback=[2000], interval=[1000], time index=[j] REDACTED
|
|
|_|_|_PromSeriesDivideExec: tags=["k"] REDACTED
|
|
|_|_|_SeriesScan: region=REDACTED, partition_count=1 (1 memtable ranges, 0 file 0 ranges), distribution=PerSeries REDACTED
|
|
|_|_|_|
|
|
|_|_| Total rows: 4_|
|
|
+-+-+-+
|
|
|
|
-- analyze at 0s, 5s and 10s. No point at 0s.
|
|
-- SQLNESS REPLACE (metrics.*) REDACTED
|
|
-- SQLNESS REPLACE (RoundRobinBatch.*) REDACTED
|
|
-- SQLNESS REPLACE (-+) -
|
|
-- SQLNESS REPLACE (\s\s+) _
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
-- SQLNESS REPLACE region=\d+\(\d+,\s+\d+\) region=REDACTED
|
|
TQL ANALYZE ('1970-01-01T00:00:00'::timestamp, '1970-01-01T00:00:00'::timestamp + '10 seconds'::interval, '5s') test;
|
|
|
|
+-+-+-+
|
|
| stage | node | plan_|
|
|
+-+-+-+
|
|
| 0_| 0_|_MergeScanExec: REDACTED
|
|
|_|_|_|
|
|
| 1_| 0_|_PromInstantManipulateExec: range=[0..10000], lookback=[300000], interval=[5000], time index=[j] REDACTED
|
|
|_|_|_PromSeriesDivideExec: tags=["k"] REDACTED
|
|
|_|_|_SeriesScan: region=REDACTED, partition_count=1 (1 memtable ranges, 0 file 0 ranges), distribution=PerSeries REDACTED
|
|
|_|_|_|
|
|
|_|_| Total rows: 4_|
|
|
+-+-+-+
|
|
|
|
-- analyze verbose at 0s, 5s and 10s. No point at 0s.
|
|
-- SQLNESS REPLACE (-+) -
|
|
-- SQLNESS REPLACE (\s\s+) _
|
|
-- SQLNESS REPLACE (elapsed_compute.*) REDACTED
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
-- SQLNESS REPLACE (RoundRobinBatch.*) REDACTED
|
|
-- SQLNESS REPLACE (metrics.*) REDACTED
|
|
-- SQLNESS REPLACE (Duration.*) REDACTED
|
|
-- SQLNESS REPLACE region=\d+\(\d+,\s+\d+\) region=REDACTED
|
|
TQL ANALYZE VERBOSE (0, 10, '5s') test;
|
|
|
|
+-+-+-+
|
|
| stage | node | plan_|
|
|
+-+-+-+
|
|
| 0_| 0_|_MergeScanExec: REDACTED
|
|
|_|_|_|
|
|
| 1_| 0_|_PromInstantManipulateExec: range=[0..10000], lookback=[300000], interval=[5000], time index=[j] REDACTED
|
|
|_|_|_PromSeriesDivideExec: tags=["k"] REDACTED
|
|
|_|_|_SeriesScan: region=REDACTED, partition_count=1 (1 memtable ranges, 0 file 0 ranges), distribution=PerSeries, projection=["i", "j", "k"], filters=[j >= TimestampMillisecond(-300000, None), j <= TimestampMillisecond(310000, None)], REDACTED
|
|
|_|_|_|
|
|
|_|_| Total rows: 4_|
|
|
+-+-+-+
|
|
|
|
DROP TABLE test;
|
|
|
|
Affected Rows: 0
|
|
|
|
-- partition table
|
|
CREATE TABLE test(i DOUBLE, j TIMESTAMP TIME INDEX, k STRING, l STRING, PRIMARY KEY(k, l)) PARTITION ON COLUMNS (k) (k < 'a', k >= 'a');
|
|
|
|
Affected Rows: 0
|
|
|
|
-- SQLNESS REPLACE (metrics.*) REDACTED
|
|
-- SQLNESS REPLACE (RoundRobinBatch.*) REDACTED
|
|
-- SQLNESS REPLACE (-+) -
|
|
-- SQLNESS REPLACE (\s\s+) _
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
-- SQLNESS REPLACE region=\d+\(\d+,\s+\d+\) region=REDACTED
|
|
TQL ANALYZE (0, 10, '5s') test;
|
|
|
|
+-+-+-+
|
|
| stage | node | plan_|
|
|
+-+-+-+
|
|
| 0_| 0_|_SortPreservingMergeExec: [k@2 ASC, l@3 ASC, j@1 ASC] REDACTED
|
|
|_|_|_SortExec: expr=[k@2 ASC, l@3 ASC, j@1 ASC], preserve_partitioning=[true] REDACTED
|
|
|_|_|_MergeScanExec: REDACTED
|
|
|_|_|_|
|
|
| 1_| 0_|_PromInstantManipulateExec: range=[0..10000], lookback=[300000], interval=[5000], time index=[j] REDACTED
|
|
|_|_|_PromSeriesDivideExec: tags=["k", "l"] REDACTED
|
|
|_|_|_SeriesScan: region=REDACTED, partition_count=0 (0 memtable ranges, 0 file 0 ranges), distribution=PerSeries REDACTED
|
|
|_|_|_|
|
|
| 1_| 1_|_PromInstantManipulateExec: range=[0..10000], lookback=[300000], interval=[5000], time index=[j] REDACTED
|
|
|_|_|_PromSeriesDivideExec: tags=["k", "l"] REDACTED
|
|
|_|_|_SeriesScan: region=REDACTED, partition_count=0 (0 memtable ranges, 0 file 0 ranges), distribution=PerSeries REDACTED
|
|
|_|_|_|
|
|
|_|_| Total rows: 0_|
|
|
+-+-+-+
|
|
|
|
-- SQLNESS REPLACE (metrics.*) REDACTED
|
|
-- SQLNESS REPLACE (RoundRobinBatch.*) REDACTED
|
|
-- SQLNESS REPLACE (-+) -
|
|
-- SQLNESS REPLACE (\s\s+) _
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
-- SQLNESS REPLACE region=\d+\(\d+,\s+\d+\) region=REDACTED
|
|
TQL ANALYZE (0, 10, '5s') rate(test[10s]);
|
|
|
|
+-+-+-+
|
|
| stage | node | plan_|
|
|
+-+-+-+
|
|
| 0_| 0_|_SortPreservingMergeExec: [k@2 ASC, l@3 ASC, j@0 ASC] REDACTED
|
|
|_|_|_SortExec: expr=[k@2 ASC, l@3 ASC, j@0 ASC], preserve_partitioning=[true] REDACTED
|
|
|_|_|_MergeScanExec: REDACTED
|
|
|_|_|_|
|
|
| 1_| 0_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED
|
|
|_|_|_FilterExec: prom_rate(j_range,i,j,Int64(10000))@1 IS NOT NULL REDACTED
|
|
|_|_|_ProjectionExec: expr=[j@1 as j, prom_rate(j_range@4, i@0, j@1, 10000) as prom_rate(j_range,i,j,Int64(10000)), k@2 as k, l@3 as l] REDACTED
|
|
|_|_|_PromRangeManipulateExec: req range=[0..10000], interval=[5000], eval range=[10000], time index=[j] REDACTED
|
|
|_|_|_PromSeriesNormalizeExec: offset=[0], time index=[j], filter NaN: [true] REDACTED
|
|
|_|_|_PromSeriesDivideExec: tags=["k", "l"] REDACTED
|
|
|_|_|_SeriesScan: region=REDACTED, partition_count=0 (0 memtable ranges, 0 file 0 ranges), distribution=PerSeries REDACTED
|
|
|_|_|_|
|
|
| 1_| 1_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED
|
|
|_|_|_FilterExec: prom_rate(j_range,i,j,Int64(10000))@1 IS NOT NULL REDACTED
|
|
|_|_|_ProjectionExec: expr=[j@1 as j, prom_rate(j_range@4, i@0, j@1, 10000) as prom_rate(j_range,i,j,Int64(10000)), k@2 as k, l@3 as l] REDACTED
|
|
|_|_|_PromRangeManipulateExec: req range=[0..10000], interval=[5000], eval range=[10000], time index=[j] REDACTED
|
|
|_|_|_PromSeriesNormalizeExec: offset=[0], time index=[j], filter NaN: [true] REDACTED
|
|
|_|_|_PromSeriesDivideExec: tags=["k", "l"] REDACTED
|
|
|_|_|_SeriesScan: region=REDACTED, partition_count=0 (0 memtable ranges, 0 file 0 ranges), distribution=PerSeries REDACTED
|
|
|_|_|_|
|
|
|_|_| Total rows: 0_|
|
|
+-+-+-+
|
|
|
|
drop table test;
|
|
|
|
Affected Rows: 0
|
|
|