├── LICENSE └── README.md /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Alex Yarotsky 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Awesome Rails With Postgres 2 | 3 | ActiveRecord and Postgres do a lot. These gems help them to do much more together. 4 | 5 | ## Table of Contents 6 | 7 | - [Gems](#gems) 8 | - [Books](#books) 9 | 10 | ## Gems 11 | 12 | ### Performance Optimization 13 | 14 | - [Alba](https://github.com/okuramasafumi/alba) – JSON serialization at warp speed 15 | - [N+1 Control](https://github.com/palkan/n_plus_one_control) – Test for N+1 queries before they hit prod 16 | - [bullet](https://github.com/flyerhzm/bullet) – Helps to find N+1 queries 17 | - [prosopite](https://github.com/charkost/prosopite) – Helps to find N+1 queries 18 | - [Columns Trace](https://github.com/fatkodima/columns_trace) – Know which columns actually get used 19 | - [Goldiloader](https://github.com/salsify/goldiloader) – Automatic eager loading so you don’t have to 20 | - [Fast Count](https://github.com/fatkodima/fast_count) – COUNT(*) but without the existential crisis 21 | - [occams-record](https://github.com/jhollinger/occams-record) – Accelerates ActiveRecord with 3x-5x faster queries, reduced memory usage, and enhanced SQL features 22 | - [postgresql_cursor](https://github.com/afair/postgresql_cursor) – Efficiently paginate through large datasets using Postgres cursors 23 | - [Rails PG Extras](https://github.com/pawurb/rails-pg-extras) – EXPLAIN ANALYZE without the headaches 24 | - [ActiveRecord Analyze](https://github.com/pawurb/activerecord-analyze) – EXPLAIN ANALYZE, but make it easy 25 | - [Passive Columns](https://github.com/headmandev/passive_columns) – Keep unused columns from slowing you down 26 | - [geared_pagination](https://github.com/basecamp/geared_pagination) – Simple, performance-focused pagination for large datasets 27 | - [pagy](https://github.com/ddnexus/pagy) – The fastest pagination gem for Ruby on Rails 28 | - [Isolator](https://github.com/palkan/isolator) – Detect non-atomic interactions within DB transactions 29 | 30 | ### Query Enhancement 31 | 32 | - [Hightop](https://github.com/ankane/hightop) – GROUP BY, but make it fast 33 | - [Groupdate](https://github.com/ankane/groupdate) – Time-based queries without the pain 34 | - [Rollup](https://github.com/ankane/rollup) – Incrementally aggregate data in Postgres for fast reporting 35 | - [Neighbor](https://github.com/ankane/neighbor) – Fast nearest-neighbor search, ActiveRecord style 36 | - [ActiveRecordExtended](https://github.com/GeorgeKaraszi/ActiveRecordExtended) – Extend ActiveRecord with additional methods for common use cases, including querying and relation handling 37 | 38 | ### Soft Deletes and Versioning 39 | 40 | - [Discard](https://github.com/jhawthorn/discard) – Soft deletes done right 41 | - [logidze](https://github.com/palkan/logidze) – Maintain an immutable history of ActiveRecord models with ease 42 | - [audited](https://github.com/collectiveidea/audited) – Track changes to ActiveRecord models and maintain a history of data modifications 43 | - [paper_trail](https://github.com/paper-trail-gem/paper_trail) – Track changes to your ActiveRecord models and keep a history of all updates, deletes, and restores 44 | - [paranoia](https://github.com/rubysherpas/paranoia) – Soft delete support for ActiveRecord models, ensuring deleted records can be recovered 45 | 46 | ### Multi-Tenancy 47 | 48 | - [acts_as_tenant](https://github.com/ErwinM/acts_as_tenant) – Multi-tenancy support for Rails applications, simplifying tenant scoping 49 | 50 | ### Full-text Search 51 | 52 | - [pg_search](https://github.com/Casecommons/pg_search) – Full-text search with Postgres for Rails applications 53 | - [textacular](https://github.com/textacular/textacular) – Powerful text search for Postgres in Rails, with support for full-text and trigram search 54 | 55 | ### Database Structure and Schema Management 56 | 57 | - [Scenic](https://github.com/scenic-views/scenic) – Views aren't just for frontend devs 58 | - [fx](https://github.com/teoljungberg/fx) – Adds methods to ActiveRecord::Migration to create and manage database functions and triggers in Rails 59 | - [ActiveRecord Postgres Enum](https://github.com/bibendi/-activerecord-postgres_enum) – Native Postgres enums without the hassle 60 | - [Strong Migrations](https://github.com/ankane/strong_migrations) – Deploy without breaking literally everything 61 | - [Online Migrations](https://github.com/fatkodima/online_migrations) – Migrate without downtime 62 | - [pg_ha_migrations](https://github.com/braintree/pg_ha_migrations) – Postgres migration tool for high availability and failover scenarios 63 | - [The Schema Is](https://github.com/zverok/the_schema_is) – Keep your schema.rb in check 64 | - [annotaterb](https://github.com/drwl/annotaterb) – Automatically annotate your Ruby files with file metadata, such as author or date 65 | - [ActiveRecord PostGIS Adapter](https://github.com/rgeo/activerecord-postgis-adapter) – Spatial data, the Rails way 66 | - [rgeo](https://github.com/rgeo/rgeo) – Geospatial data handling for Ruby on Rails with support for PostGIS and other spatial extensions 67 | - [ActiveRecord TypedStore](https://github.com/byroot/activerecord-typedstore) – Strongly typed ActiveRecord 68 | 69 | ### Attributes Management 70 | 71 | - [Measured](https://github.com/Shopify/measured) – Keep units in check before they break things 72 | - [awesome_nested_set](https://github.com/collectiveidea/awesome_nested_set) – An easy-to-use gem for storing hierarchical data in ActiveRecord 73 | - [store_model](https://github.com/DmitryTsepelev/store_model) – Persist attributes on models as a serialized data column while keeping ActiveRecord’s features intact 74 | - [ranked-model](https://github.com/brendon/ranked-model) – Easily manage ranked records with ActiveRecord 75 | - [store_attribute](https://github.com/palkan/store_attribute) – Store model attributes in the database in a more structured way 76 | - [acts-as-taggable-on](https://github.com/mbleigh/acts-as-taggable-on) – Add tagging functionality to any ActiveRecord model with ease 77 | 78 | ### Caching and Indexing 79 | 80 | - [Blind Index](https://github.com/ankane/blind_index) – Encrypt data without losing searchability 81 | - [wt_activerecord_index_spy](https://github.com/WeTransfer/wt_activerecord_index_spy) – Identify indexes that are never used 82 | - [Counter Culture](https://github.com/magnusvk/counter_culture) – Stop recalculating counters like it's 2010 83 | - [Identity Cache](https://github.com/Shopify/identity_cache) – Caching, but the Shopify way 84 | 85 | ### Database Integrity and Data Consistency 86 | 87 | - [Database Consistency](https://github.com/djezzzl/database_consistency) – Finds schema & data issues before they find you 88 | - [Active Record Doctor](https://github.com/gregnavis/active_record_doctor) – Your schema needs a checkup 89 | - [activerecord-clean-db-structure](https://github.com/lfittl/activerecord-clean-db-structure) – Keep your schema clean 90 | 91 | ### Bulk Operations 92 | 93 | - [ActiveRecord Import](https://github.com/zdennis/activerecord-import) – Bulk inserts that fly 94 | - [postgres-copy](https://github.com/diogob/postgres-copy) – Fast bulk data import/export for Postgres 95 | 96 | ### Data Management 97 | 98 | - [pgsync](https://github.com/ankane/pgsync) – Synchronize Postgres databases with ease, ideal for staging/production sync 99 | - [evil-seed](https://github.com/evilmartians/evil-seed) – Generate realistic, yet safe, dummy data for testing and development 100 | - [Maintenance Tasks](https://github.com/Shopify/maintenance_tasks) – Simplifies data migration management 101 | 102 | ### Tools 103 | 104 | - [pgcli-rails](https://github.com/mattbrictson/pgcli-rails) – A better Postgres console for Rails 105 | - [pghero](https://github.com/ankane/pghero) – Postgres performance insights 106 | 107 | ## Books 108 | 109 | - [High Performance PostgreSQL for Rails](https://pragprog.com/titles/aapsql/high-performance-postgresql-for-rails/) 110 | - [Lift the Elephant](https://leanpub.com/lift-the-elephant) 111 | - [Rails Scales!](https://pragprog.com/titles/cprpo/rails-scales/) 112 | - [Polished Ruby Programming: Build better software with more intuitive, maintainable, scalable, and high-performance Ruby code](https://www.packtpub.com/en-us/product/polished-ruby-programming-9781801072724) 113 | --------------------------------------------------------------------------------