finds.dev

plentz/lol_dba

lol_dba is a small package of rake tasks that scan your application models and displays a list of columns that probably should be indexed. Also, it can generate .sql migration scripts.

View on GitHub

★ 1,594Rubyupdated Mar 2026

// the take

lol_dba scans your Rails ActiveRecord models and tells you which foreign key and join columns are missing database indexes. It works by introspecting your model associations rather than your actual query patterns, so it catches the obvious structural gaps — the `_id` columns sitting there unindexed because you added a `belongs_to` and forgot the migration.

Covers the full Rails association surface: belongs_to, has_many :through, has_and_belongs_to_many — it handles the join table cases that people most often forget. The Appraisals test matrix going from Rails 3.2 through 8.x is genuinely thorough and shows the maintainer cares about not breaking existing users on upgrades. The SQL migration generator is a nice touch for teams that need to hand off DDL to a DBA rather than run Rails migrations directly. Zero configuration — drop it in the Gemfile, run one rake task, get actionable output.

It only knows about associations, not query patterns. Columns you filter or sort on frequently but aren't foreign keys won't show up, so you'll still miss real-world performance problems that can't be inferred from the model layer alone. The tool has no awareness of partial indexes, composite indexes, or whether an existing index already covers the column as a non-leading key — so its suggestions can be redundant or miss nuance. With 1594 stars and 70 forks after many years, this is a narrow utility that most teams use once during an audit and then forget, not something that stays in the toolchain. Last meaningful activity is sparse given the Rails 8 support was likely a compatibility bump, not feature work.

We read the README, the directory tree and a key source file in July 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
1,594
Forks
70
Language
Ruby
Last commit
23 Mar 2026

// nearby

If lol_dba isn't quite it.

All repos →