mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-06 05:12:54 +00:00
* perf: avoid unnecessary merge sort Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * fantastic if chain Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * more comments Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * fix typo Signed-off-by: Ruihang Xia <waynestxia@gmail.com> --------- Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
175 lines
7.9 KiB
Plaintext
175 lines
7.9 KiB
Plaintext
-- no partition
|
|
create table t (
|
|
i double,
|
|
j timestamp time index,
|
|
k string primary key
|
|
);
|
|
|
|
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
|
|
-- SQLNESS REPLACE (Hash.*) REDACTED
|
|
tql analyze (0, 10, '1s') 100 - (avg by (k) (irate(t[1m])) * 100);
|
|
|
|
+-+-+-+
|
|
| stage | node | plan_|
|
|
+-+-+-+
|
|
| 0_| 0_|_CooperativeExec REDACTED
|
|
|_|_|_MergeScanExec: REDACTED
|
|
|_|_|_|
|
|
| 1_| 0_|_ProjectionExec: expr=[k@0 as k, j@1 as j, 100 - avg(prom_irate(j_range,i))@2 * 100 as Float64(100) - avg(prom_irate(j_range,i)) * Float64(100)] REDACTED
|
|
|_|_|_RepartitionExec: partitioning=REDACTED
|
|
|_|_|_SortPreservingMergeExec: [k@0 ASC NULLS LAST, j@1 ASC NULLS LAST] REDACTED
|
|
|_|_|_SortExec: expr=[k@0 ASC NULLS LAST, j@1 ASC NULLS LAST], preserve_partitioning=[true] REDACTED
|
|
|_|_|_AggregateExec: mode=FinalPartitioned, gby=[k@0 as k, j@1 as j], aggr=[avg(prom_irate(j_range,i))] REDACTED
|
|
|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED
|
|
|_|_|_RepartitionExec: partitioning=REDACTED
|
|
|_|_|_AggregateExec: mode=Partial, gby=[k@2 as k, j@0 as j], aggr=[avg(prom_irate(j_range,i))] REDACTED
|
|
|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED
|
|
|_|_|_FilterExec: prom_irate(j_range,i)@1 IS NOT NULL REDACTED
|
|
|_|_|_ProjectionExec: expr=[j@1 as j, prom_irate(j_range@3, i@0) as prom_irate(j_range,i), k@2 as k] REDACTED
|
|
|_|_|_PromRangeManipulateExec: req range=[0..10000], interval=[1000], eval range=[60000], time index=[j] REDACTED
|
|
|_|_|_PromSeriesNormalizeExec: offset=[0], time index=[j], filter NaN: [true] REDACTED
|
|
|_|_|_PromSeriesDivideExec: tags=["k"] REDACTED
|
|
|_|_|_CooperativeExec REDACTED
|
|
|_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":0, "mem_ranges":0, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED
|
|
|_|_|_|
|
|
|_|_| Total rows: 0_|
|
|
+-+-+-+
|
|
|
|
drop table t;
|
|
|
|
Affected Rows: 0
|
|
|
|
-- partition on tag
|
|
create table t (
|
|
i double,
|
|
j timestamp time index,
|
|
k string,
|
|
l string,
|
|
primary key (k, l)
|
|
) partition on columns (k, l) (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
|
|
-- SQLNESS REPLACE (Hash.*) REDACTED
|
|
tql analyze (0, 10, '1s') 100 - (avg by (k) (irate(t[1m])) * 100);
|
|
|
|
+-+-+-+
|
|
| stage | node | plan_|
|
|
+-+-+-+
|
|
| 0_| 0_|_ProjectionExec: expr=[k@0 as k, j@1 as j, 100 - avg(prom_irate(j_range,i))@2 * 100 as Float64(100) - avg(prom_irate(j_range,i)) * Float64(100)] REDACTED
|
|
|_|_|_RepartitionExec: partitioning=REDACTED
|
|
|_|_|_SortPreservingMergeExec: [k@0 ASC NULLS LAST, j@1 ASC NULLS LAST] REDACTED
|
|
|_|_|_SortExec: expr=[k@0 ASC NULLS LAST, j@1 ASC NULLS LAST], preserve_partitioning=[true] REDACTED
|
|
|_|_|_AggregateExec: mode=FinalPartitioned, gby=[k@0 as k, j@1 as j], aggr=[avg(prom_irate(j_range,i))] REDACTED
|
|
|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED
|
|
|_|_|_RepartitionExec: partitioning=REDACTED
|
|
|_|_|_AggregateExec: mode=Partial, gby=[k@0 as k, j@1 as j], aggr=[avg(prom_irate(j_range,i))] REDACTED
|
|
|_|_|_CooperativeExec REDACTED
|
|
|_|_|_MergeScanExec: REDACTED
|
|
|_|_|_|
|
|
| 1_| 0_|_AggregateExec: mode=FinalPartitioned, gby=[k@0 as k, j@1 as j], aggr=[__avg_state(prom_irate(j_range,i))] REDACTED
|
|
|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED
|
|
|_|_|_RepartitionExec: partitioning=REDACTED
|
|
|_|_|_AggregateExec: mode=Partial, gby=[k@2 as k, j@0 as j], aggr=[__avg_state(prom_irate(j_range,i))] REDACTED
|
|
|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED
|
|
|_|_|_FilterExec: prom_irate(j_range,i)@1 IS NOT NULL REDACTED
|
|
|_|_|_ProjectionExec: expr=[j@1 as j, prom_irate(j_range@4, i@0) as prom_irate(j_range,i), k@2 as k] REDACTED
|
|
|_|_|_PromRangeManipulateExec: req range=[0..10000], interval=[1000], eval range=[60000], time index=[j] REDACTED
|
|
|_|_|_PromSeriesNormalizeExec: offset=[0], time index=[j], filter NaN: [true] REDACTED
|
|
|_|_|_PromSeriesDivideExec: tags=["k", "l"] REDACTED
|
|
|_|_|_CooperativeExec REDACTED
|
|
|_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":0, "mem_ranges":0, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED
|
|
|_|_|_|
|
|
| 1_| 1_|_AggregateExec: mode=FinalPartitioned, gby=[k@0 as k, j@1 as j], aggr=[__avg_state(prom_irate(j_range,i))] REDACTED
|
|
|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED
|
|
|_|_|_RepartitionExec: partitioning=REDACTED
|
|
|_|_|_AggregateExec: mode=Partial, gby=[k@2 as k, j@0 as j], aggr=[__avg_state(prom_irate(j_range,i))] REDACTED
|
|
|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED
|
|
|_|_|_FilterExec: prom_irate(j_range,i)@1 IS NOT NULL REDACTED
|
|
|_|_|_ProjectionExec: expr=[j@1 as j, prom_irate(j_range@4, i@0) as prom_irate(j_range,i), k@2 as k] REDACTED
|
|
|_|_|_PromRangeManipulateExec: req range=[0..10000], interval=[1000], eval range=[60000], time index=[j] REDACTED
|
|
|_|_|_PromSeriesNormalizeExec: offset=[0], time index=[j], filter NaN: [true] REDACTED
|
|
|_|_|_PromSeriesDivideExec: tags=["k", "l"] REDACTED
|
|
|_|_|_CooperativeExec REDACTED
|
|
|_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":0, "mem_ranges":0, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED
|
|
|_|_|_|
|
|
|_|_| Total rows: 0_|
|
|
+-+-+-+
|
|
|
|
drop table t;
|
|
|
|
Affected Rows: 0
|
|
|
|
-- partition on value
|
|
create table t (
|
|
i double,
|
|
j timestamp time index,
|
|
k string,
|
|
l string,
|
|
primary key (k, l)
|
|
) partition on columns (i) (i < 1.0, i >= 1.0);
|
|
|
|
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
|
|
-- SQLNESS REPLACE (Hash.*) REDACTED
|
|
tql analyze (0, 10, '1s') 100 - (avg by (k) (irate(t[1m])) * 100);
|
|
|
|
+-+-+-+
|
|
| stage | node | plan_|
|
|
+-+-+-+
|
|
| 0_| 0_|_ProjectionExec: expr=[k@0 as k, j@1 as j, 100 - avg(prom_irate(j_range,i))@2 * 100 as Float64(100) - avg(prom_irate(j_range,i)) * Float64(100)] REDACTED
|
|
|_|_|_RepartitionExec: partitioning=REDACTED
|
|
|_|_|_SortPreservingMergeExec: [k@0 ASC NULLS LAST, j@1 ASC NULLS LAST] REDACTED
|
|
|_|_|_SortExec: expr=[k@0 ASC NULLS LAST, j@1 ASC NULLS LAST], preserve_partitioning=[true] REDACTED
|
|
|_|_|_AggregateExec: mode=FinalPartitioned, gby=[k@0 as k, j@1 as j], aggr=[avg(prom_irate(j_range,i))] REDACTED
|
|
|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED
|
|
|_|_|_RepartitionExec: partitioning=REDACTED
|
|
|_|_|_AggregateExec: mode=Partial, gby=[k@2 as k, j@0 as j], aggr=[avg(prom_irate(j_range,i))] REDACTED
|
|
|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED
|
|
|_|_|_FilterExec: prom_irate(j_range,i)@1 IS NOT NULL REDACTED
|
|
|_|_|_ProjectionExec: expr=[j@1 as j, prom_irate(j_range@4, i@0) as prom_irate(j_range,i), k@2 as k] REDACTED
|
|
|_|_|_PromRangeManipulateExec: req range=[0..10000], interval=[1000], eval range=[60000], time index=[j] REDACTED
|
|
|_|_|_PromSeriesNormalizeExec: offset=[0], time index=[j], filter NaN: [true] REDACTED
|
|
|_|_|_PromSeriesDivideExec: tags=["k", "l"] REDACTED
|
|
|_|_|_SortExec: expr=[k@2 ASC, l@3 ASC, j@1 ASC], preserve_partitioning=[true] REDACTED
|
|
|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED
|
|
|_|_|_RepartitionExec: partitioning=REDACTED
|
|
|_|_|_CooperativeExec REDACTED
|
|
|_|_|_CooperativeExec REDACTED
|
|
|_|_|_MergeScanExec: REDACTED
|
|
|_|_|_|
|
|
| 1_| 0_|_SortPreservingMergeExec: [k@2 ASC, l@3 ASC, j@1 ASC] REDACTED
|
|
|_|_|_CooperativeExec REDACTED
|
|
|_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":0, "mem_ranges":0, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED
|
|
|_|_|_|
|
|
| 1_| 1_|_SortPreservingMergeExec: [k@2 ASC, l@3 ASC, j@1 ASC] REDACTED
|
|
|_|_|_CooperativeExec REDACTED
|
|
|_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":0, "mem_ranges":0, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED
|
|
|_|_|_|
|
|
|_|_| Total rows: 0_|
|
|
+-+-+-+
|
|
|
|
drop table t;
|
|
|
|
Affected Rows: 0
|
|
|