adriangb commented on PR #27738: URL: https://github.com/apache/datafusion/pull/27738#issuecomment-7177877684
## Benchmark results https://github.com/apache/datafusion/pull/27761 adds a sort-pushdown benchmark query that hits this path. It writes the `sort_pushdown_inexact` data with a page index (about 5 pages per row group) and adds q5: ```sql SELECT l_orderkey, l_partkey, l_suppkey FROM lineitem WHERE l_orderkey BETWEEN 0 AND 5000 OR l_orderkey BETWEEN 200000 AND 205000 OR ... -- 30 ranges, step 200000, width 5000 ORDER BY l_orderkey DESC LIMIT 10 ``` Setup: - Data: TPC-H SF1 `lineitem` sorted by `l_orderkey`, 61 row groups of 100K rows over 3 files. - Config: `pushdown_filters=true`, default partitions. - Build and hardware: release build on a laptop, local disk. | | `main` | this PR | |---|---|---| | `row_groups_pruned_statistics` | 61 total → 38 matched | 61 total → 38 matched | | `page_index_pages_pruned` | 190 total → 38 matched | 190 total → 38 matched | | `row_groups_pruned_dynamic_filter` | 0 | 21 | | Median of 30 iterations (run 1 / run 2) | 5.9 / 6.2 ms | 5.4 / 5.7 ms | | Min of 30 iterations (run 1 / run 2) | 5.5 / 5.5 ms | 5.0 / 5.0 ms | The median is about 8% faster. The time saved is small here, because the data is local and each surviving row group reads only about one page. The bigger change is that the scan skips 21 row groups. On object storage, each skipped row group is a request saved. The I/O trace from https://github.com/apache/datafusion/pull/27757 shows this: its requests 6 to 9 go away with this PR. A plain `WHERE tenant_id = X` filter did not show the effect. With 18 partitions, each scan has about one matching row group, and that row group holds fewer rows than the `LIMIT`. So the dynamic filter has nothing left to prune. That is why q5 uses an OR of ranges. I'll wait a day or two to merge this. If we merge https://github.com/apache/datafusion/pull/27761 before that I'll rebase and do a CI benchamrk run. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
