PlanetScale offers robust solutions for paginating results in MySQL and PostgreSQL. This includes detailed comparisons of offset/limit and cursor-based pagination, highlighting the performance drawbacks of offset/limit for deep pages. The introduction of the FastPage gem for Rails leverages the MySQL deferred join optimization to significantly improve the performance of offset/limit queries, especially for deeper pages. This gem makes it easy to apply this optimization to any ActiveRecord::Relation using offset/limit, offering a faster alternative for applications that rely on this pagination strategy.
All PlanetScale trails