fast_page
Seed dump
fast_page | Seed dump | |
---|---|---|
2 | 2 | |
292 | 1,390 | |
1.0% | - | |
2.9 | 0.0 | |
10 months ago | 7 months ago | |
Ruby | Ruby | |
Apache License 2.0 | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
fast_page
-
We switched to cursor-based pagination
There are ways to mitigate the (although not eliminate) the slowing down of offset/limit pagination in later pages. The technique is called a "deferred join" and it is most effective in MySQL. The basic idea is to paginate as little data as necessary, and then do a self-join to get the rest of the data for a single page.
You can read more about it here: https://aaronfrancis.com/2022/efficient-pagination-using-def... or here https://planetscale.com/blog/fastpage-faster-offset-paginati....
There are libraries for Laravel (https://github.com/hammerstonedev/fast-paginate) and Rails (https://github.com/planetscale/fast_page) as well!
Cursor based pagination is wonderful, but sometimes you're stuck with offset/limit for whatever reason. Might as well make it fast.
-
Faster offset pagination for Rails apps
In both Django and Rails, passing a QuerySet or ActiveRecord::Relation as an argument to a filter/where creates a subquery - in this case, https://github.com/planetscale/fast_page/blob/main/lib/fast_... creates SELECT ... WHERE id IN (SELECT id FROM ...).
So it's not exactly an inner join, but in theory it will be optimized to the same query plan as an inner join. That said, https://stackoverflow.com/questions/2577174/join-vs-sub-quer... has lots of commentary on why this shouldn't be depended on.
Seed dump
-
Rails - A Hidden Gem: Seed Dump
During the testing of this functionality, you're adding data to your database. Rather than resetting your database, what if you utilized the information you entered? What if this is how you could build your seed file, rather than creating it from scratch? Or what if you do some testing and just want to add a couple of live examples to your seed file? Enter Seed Dump.
- Quick question about the local PostgreSQL database when you deploy your app to production.
What are some alternatives?
fast-paginate - A fast implementation of offset/limit pagination for Laravel.
Seed Fu - Advanced seed data handling for Rails, combining the best practices of several methods together.
Scenic - Versioned database views for Rails
Database Cleaner - Strategies for cleaning databases in Ruby. Can be used to ensure a clean state for testing.
PgHero - A performance dashboard for Postgres
Rails DB - Rails Database Viewer and SQL Query Runner
Large Hadron Migrator - Online MySQL schema migrations
Seedbank - Seedbank gives your seed data a little structure. Create seeds for each environment, share seeds between environments and specify dependencies to load your seeds in order. All nicely integrated with simple rake tasks.
DatabaseValidations - Database validations for ActiveRecord
Upsert - Upsert on MySQL, PostgreSQL, and SQLite3. Transparently creates functions (UDF) for MySQL and PostgreSQL; on SQLite3, uses INSERT OR IGNORE.
Blazer - Business intelligence made simple