Files
greptimedb/tests/perf/query_cases
dennis zhuang 27182bdd69 perf(query): fill TopK heaps early over filtered region scans (#10515)
* perf(query): let a TopK over a filtered scan publish its dynamic filter early

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* perf(query): share the global TopK conditions and flush filters per batch

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* test(query): pin unsplit filter output at batch size 1

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* perf(query): balance rows when assigning ranges in time order

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* perf(query): leave TopK on other sort keys unchanged

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* perf(query): spread ranges of unknown size and test the scan wiring

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* test(query): share TopK test helpers and merge assignment cases

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* fix(query): leave fetch-limited filters alone under a TopK

A FilterExec with a fetch keeps the first rows that pass, so changing
when the TopK threshold arrives or the order ranges are read changes
which rows it keeps. Both rules now stop at such a filter.

Also use replace_children instead of the deprecated with_new_children,
and document the coalescer behavior that batch size 1 relies on.

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* fix(query): rewrite only TopKs bounded by a SortPreservingMergeExec

A partitioned TopK keeps up to fetch rows per partition, which equals
the global result only because the merge above it takes the first rows
of all partitions. Match from that merge, through projections, and
require the TopK's fetch to cover the merge's, so a TopK whose
per-partition rows are part of the result is never rewritten.

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* docs(query): state what the global TopK fetch cap does and does not bound

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* perf(query): keep per-partition TopK heaps when no range can be skipped

With no more ranges than partitions each partition reads at most one
range, so the TopK threshold leaves no later range to skip and one heap
only adds a single consumer. filtered_scan_below_topk now requires more
ranges than partitions; both callers pass the partition count they plan
for.

The small sqlness tables in order_by and windowed_sort fall under the
guard, so a new windowed_sort case with six files covers the rewrite
end to end.

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* test(perf): add a query regression case for time-index TopK over a selective filter

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* test(sqlness): say what the one-heap windowed_sort case pins

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

---------

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
2026-11-19 15:55:49 +00:00
..