Skip to content

Conversation

@adriangb
Copy link
Contributor

Currently we prefetch 1 file. In bandwith limited systems (e.g. object storage) having wider IO than CPU tends to make sense. This makes the prefetch configurable so that we can open >2 files at a time. My main concern is memory use. For now users will have to tune this manually. Long term I think we should track how much prefetched data is 'waiting' using a memory pool + the newly added memory tracking in arrow -> you can set a pretty large prefetch value and it will be throttled by memory. This means that scans with very selective filters (that produce few rows per file) will benefit heavily from wide IO prefetching while scans that produce large amounts of data will do little prefetching if they hit memory limits.

@github-actions github-actions bot added core Core DataFusion crate common Related to common crate datasource Changes to the datasource crate labels Sep 24, 2025
@adriangb adriangb force-pushed the configurable-prefetch branch from 3173a4c to 6900198 Compare September 24, 2025 17:58
Currently we prefetch 1 file. In bandwith limited systems (e.g. object storage) having wider IO than CPU tends to make sense. This makes the prefetch configurable so that we can open >2 files at a time. My main concern is memory use. For now users will have to tune this manually. Long term I think we should track how much prefetched data is 'waiting' using a memory pool + the newly added memory tracking in arrow -> you can set a pretty large prefetch value and it will be throttled by memory. This means that scans with very selective filters (that produce few rows per file) will benefit heavily from wide IO prefetching while scans that produce large amounts of data will do little prefetching if they hit memory limits.
@adriangb adriangb force-pushed the configurable-prefetch branch from 67d9137 to 27fa525 Compare October 4, 2025 20:58
@github-actions github-actions bot added the sqllogictest SQL Logic Tests (.slt) label Oct 4, 2025
@adriangb adriangb marked this pull request as ready for review October 5, 2025 04:22
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Oct 5, 2025
@adriangb
Copy link
Contributor Author

adriangb commented Oct 7, 2025

From my testing this works but doesn't seem to have much of a positive benefit (does not improve query performance). Maybe something is wrong with the implementation. But I think fundamentally the problem is that you want to go wide with IO but not really with other parts (e.g. CPU work applying filters in predicate pushdown), and this is a bit too high of a level for that. @alamb is working on changes to Parquet decoding which will allow prefetching at the byte range level, that sounds much more appropriate since we will be able to do IO-only prefetching. I will continue to do some investigations but I am going to close this for now to keep the PR backlog down.

@adriangb adriangb closed this Oct 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

common Related to common crate core Core DataFusion crate datasource Changes to the datasource crate documentation Improvements or additions to documentation sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant