# Goldiloader

> Just the right amount of Rails eager loading

Source: https://talira.ai/catalog/goldiloader-h53tw30y
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library
- Categories: [developer tools / performance / n plus one queries](https://talira.ai/categories/developer-tools/performance/n-plus-one-queries), [languages / ruby / rails](https://talira.ai/categories/languages/ruby/rails)
- Platforms: linux, macos, windows
- Licence: MIT
- Pricing: Free and open source
- Free tier: yes
- Self-hostable: yes
- Backed by: [Salsify](https://talira.ai/orgs/salsify.md)

Goldiloader removes most N+1 queries in Active Record without anyone writing `includes`: the first time code reaches an association on one record from a query, it eager loads that association for every record the query returned, however deeply nested. It assumes records from one query are used the same way, and you can turn it off for a query (`auto_include(false)`) or an association, or still eager load by hand. The current branch supports Rails 7.2 and later with Ruby 3.2 and later.

## Links

- GitHub: https://github.com/salsify/goldiloader

## Problems it solves

- I'm tired of adding includes everywhere to fix N+1 queries
- make ActiveRecord eager load associations automatically when they're used
- N+1 queries keep coming back every time someone changes a view
- load the posts for all five blogs in one query without changing the code
- fix N+1 queries across a big legacy Rails app at once
- eager loading by hand breaks when the view decides what it needs
- automatic batching of association loads in Rails

## Features

- automatic eager loading on first access
- nested associations
- auto_include(false) per query
- per-association opt-out
- works alongside includes, preload and eager_load

## Trust

Overall: 0.51 out of 1.
Signals: maintenance 0.69, adoption 0.64, momentum 0.33, community 0.58, backing 0.30, extensibility 0.00.

- last commit 8 days ago
- 14 commits in the last 90 days
- latest release v6.0.1 28 days ago
- 1.7k GitHub stars
- 27 contributors
- backed by Salsify

## Alternatives

- [Bullet](https://talira.ai/catalog/bullet-1h5ge3bv.md): Help to kill N+1 queries and unused eager loading
- [Prosopite](https://talira.ai/catalog/prosopite-x9rmtzwr.md): Rails N+1 queries auto-detection with zero false positives / false negatives
