Commit e4dd17d
fix: preserve fetch (LIMIT) when eliminating SortExec via Exact pushdown
When PushdownSort returns Exact and removes SortExec, the fetch (LIMIT)
from the original SortExec was lost. DataSourceExec then reads all data
instead of stopping early.
Now passes sort_exec.fetch() to inner.with_fetch() so DataSourceExec
gets limit=N and stops reading after N rows.
Benchmark impact (6M rows, reversed file names):
Q2 ORDER BY LIMIT 100: main 1237ms → 9ms (99% faster)
Q4 SELECT * LIMIT 100: main 5971ms → 24ms (99.6% faster)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 46fa442 commit e4dd17d
1 file changed
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
103 | 110 | | |
104 | 111 | | |
105 | 112 | | |
| |||
0 commit comments