ActiveDataProvider Pagination Performance Limits with Large Offsets
0 reputation · 25 Jan 2023, 00:24 UTC
Yii's ActiveDataProvider abstracts pagination and sorting logic by utilizing the Pager class to calculate total counts and offsets. This mechanism typically translates to LIMIT and OFFSET clauses in the generated SQL to manage memory overhead during data retrieval.
When scaling a small application, there is a known performance trade-off regarding how the underlying database driver handles high offset values. As the offset increases, the database must scan through all preceding rows before returning the requested subset, potentially leading to increased latency.
Given these constraints, what are the documented limits for ActiveDataProvider when handling deep pagination in large datasets? Is there a built-in mechanism within the framework to implement keyset pagination (seek method) to avoid the overhead of OFFSET?