Home / Companies / PlanetScale / Blog / Post Details
Content Deep Dive

Introducing FastPage: Faster offset pagination for Rails apps

Blog post from PlanetScale

Post Details
Company
Date Published
Author
Mike Coutermarsh
Word Count
610
Company Posts That Month
11
Language
English
Hacker News Points
107
Post removed?
No
Summary

We'd like to introduce FastPage, a new gem for ActiveRecord that applies the MySQL "deferred join" optimization to offset/limit queries. A slow pagination query in Rails was found to be 2.7x faster when using `fast_page`. The optimized technique works by first selecting the ID of all rows to show, then fetching the data for those rows, reducing the amount of data accessed and processed by the database. This gem is best used on pagination queries with an ORDER BY clause, particularly for deeper pages where performance benefits are most noticeable. It's recommended to test its effectiveness on your application's data to determine when it improves query times.

Trends Found in this Post

No tracked trend matches for this post yet.

Use This Data

Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.