How much should a Rails (or I guess non-DBA in general) developer learn about Postgres' EXPLAIN up front? Is it worth becoming closely familiar with query plans before having specific queries to improve, or is this something you learned as and when you needed it?

https://www.postgresql.org/docs/current/using-explain.html

@jsrn A Rails developer is going to have a wide array of possibilities in front of them. It’s a very good arrow to have in your quiver.

Personally, I’d aim for more than casual awareness over fluency.

@jremsikjr Thanks, Jim!
@jsrn Of course. It’s my opinion so take it with that caveat. 😉
@jsrn Good to be aware of, but usually not relevant for new projects. This is a great resource on optimization https://use-the-index-luke.com/
SQL Indexing and Tuning e-Book for developers: Use The Index, Luke covers Oracle, MySQL, PostgreSQL, SQL Server, ...

SQL indexing and tuning tutorial for developers. No unnecessary database details—just what developers need to know. Covers all major SQL databases.

@jsrn IMO, it’s a lot easier to understand the output when you have a concrete, real-life query which performs terribly. I think I’ve only looked at EXPLAIN after something was slow. (or before deploying something which I suspected would be slow.)