>_ hackerrepos search repos…

← top repos

salsify/goldiloader

Just the right amount of Rails eager loading

▲ 1 hacker recommends Ruby ★ 1.7k MIT activerecordeager-loadinggemhacktoberfestperformanceruby-on-rails

Recommended between 2025-10-03 and 2025-10-03. Last pushed 2026-10-31.

▲ 1 recommend · ▼ 0 criticisms

What hackers say

“there's ar_lazy_preloader[0] or goldiloader[1] which fix many N+1s by keeping track of a context”

— riffraff, 2025-10-03 · original comment on Hacker News ↗

show original comment

I think many ORMs can solve (some of) this these days. e.g. for ActiveRecord there's ar_lazy_preloader[0] or goldiloader[1] which fix many N+1s by keeping track of a context: you load a set of User in one go, and when you do user.posts it will do a single query for all, and when you then access post.likes it will load all likes for those and so on. Or, if you get the records some other way, you add them to a shared context and then it works. Doesn't solve everything, but helps quite a bit. [0] https://github.com/DmitryTsepelev/ar_lazy_preload [1] https://github.com/salsify/goldiloader

Badge for your README

hackers recommend badge
[![hackers recommend](https://hackerrepos.org/badge/salsify/goldiloader.svg)](https://hackerrepos.org/repo/salsify/goldiloader)

Alternatives hackers mention