<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Explain on Ivan Luminaria</title><link>https://ivanluminaria.com/en/tags/explain/</link><description>Recent content in Explain on Ivan Luminaria</description><generator>Hugo</generator><language>en</language><lastBuildDate>Tue, 28 Oct 2025 08:03:00 +0100</lastBuildDate><atom:link href="https://ivanluminaria.com/en/tags/explain/index.xml" rel="self" type="application/rss+xml"/><item><title>EXPLAIN ANALYZE is not enough: how to actually read a PostgreSQL execution plan</title><link>https://ivanluminaria.com/en/posts/postgresql/explain-analyze-postgresql/</link><pubDate>Tue, 28 Oct 2025 08:03:00 +0100</pubDate><guid>https://ivanluminaria.com/en/posts/postgresql/explain-analyze-postgresql/</guid><description>&lt;p&gt;The other day a colleague sends me a screenshot on Teams. A query running on a 2-million-row table, 45 seconds execution time. He writes:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;ldquo;I ran EXPLAIN ANALYZE, but I can&amp;rsquo;t figure out what&amp;rsquo;s wrong. The plan looks fine.&amp;rdquo;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Spoiler: the plan was anything but fine. The optimizer had chosen a &lt;span class="glossary-tip" tabindex="0" data-glossary-desc="Nested Loop Join — the join strategy that scans the inner table for each row of the outer table, ideal for small datasets with an index." data-glossary-url="https://ivanluminaria.com/en/glossary/nested-loop/" data-glossary-more="Read more →"&gt;nested loop&lt;/span&gt;
 join where a &lt;span class="glossary-tip" tabindex="0" data-glossary-desc="Hash Join — a join strategy optimized for large data volumes, based on a hash table built in memory." data-glossary-url="https://ivanluminaria.com/en/glossary/hash-join/" data-glossary-more="Read more →"&gt;hash join&lt;/span&gt;
 was needed, and the reason was trivial — stale statistics. But to get there I had to read the plan line by line, and that&amp;rsquo;s when I realized that most DBAs I know use EXPLAIN ANALYZE as a binary oracle: if the time is high, the query is slow. End of analysis.&lt;/p&gt;</description></item></channel></rss>