Rusty Brick analyzed the efficiency of using `file_row_number` versus `offset` for paginating through Parquet files in DuckDB [1].
This comparison is critical for developers managing massive datasets, as the choice of query method directly impacts the speed of data retrieval and system resource consumption.
In the analysis, Brick examined how DuckDB handles the process of skipping records to reach a specific starting point in a file. The results indicate that `file_row_number` is generally faster than `offset` when working with large files [1]. This performance gap occurs because of how the database engine interacts with the underlying storage format.
"Using file_row_number is generally faster than offset for large files," Brick said [1].
The inefficiency of the `offset` method stems from the way the system must locate the required data. According to the analysis, the database cannot simply jump to a specific record when using an offset.
"Offset can be slower because it requires DuckDB to scan the entire file to find the correct starting point," Brick said [1].
By contrast, `file_row_number` allows the engine to utilize the structural properties of the Parquet file more effectively. This reduces the amount of data the system must process before it can begin returning the requested rows. The findings suggest that for any application requiring high-performance pagination, such as data dashboards or large-scale analytics tools, the `file_row_number` approach is the superior technical choice [1].
“"Using file_row_number is generally faster than offset for large files."”
This finding highlights a common bottleneck in big data processing where logical query commands do not always align with physical storage efficiency. By opting for file-aware row numbering over generic offsets, engineers can reduce compute overhead and latency, allowing DuckDB to scale more effectively across multi-gigabyte Parquet datasets.



