Reflection — An Honest Take 8 min

Honest Take — Before You Begin

PostgreSQL is the best database in the world. I am not being hyperbolic. It is open source, absurdly reliable, standards-compliant, extensible, and improving faster than any commercial database. And you have been using it through a translation layer for your entire career. ActiveRecord is a fine translator, but it is still a translator. This module removes the middleman.

EXPLAIN ANALYZE is the single most valuable skill in this entire curriculum. Not this module -- this entire program. Learning to read query plans is like learning to read stack traces: once you can do it, debugging goes from guesswork to science. You will look at a query plan and see the sequential scan that is killing your endpoint. You will see the nested loop join that should be a hash join. You will see the estimated rows versus actual rows diverge and know your statistics are stale. This is the skill that makes senior engineers look like wizards. They are not wizards. They just read the plan.

Learn psql. Most Rails developers use Postico or pgAdmin or whatever GUI is popular this year. Those are fine for browsing data. But psql is faster, scriptable, available on every server you will ever SSH into, and forces you to think in SQL rather than clicking through a visual interface. Learn \d, \dt, \di, \x, \timing. They become muscle memory faster than you think.

PostgreSQL-specific features -- JSONB, arrays, range types, full-text search, CTEs, lateral joins -- are things ActiveRecord supports poorly or not at all. Learning them directly means you stop reaching for Redis or Elasticsearch for problems PostgreSQL already solves. Your stack gets simpler. Simpler stacks break less.

Learning resources 5

That's the free preview. Sign in to continue this course.

Sign in to continue

New here? Make a desk →