Thread: Reading explain plans- row estimates/actuals on lower nodes vs nextlevel up

Reading explain plans- row estimates/actuals on lower nodes vs nextlevel up

From
Michael Lewis
Date:
https://explain.depesz.com/s/Caa5

I am looking at this explain analyze output and seeing a nested loop towards the lowest levels with pretty bad estimate vs actual (2.3k vs 99k), but the things that feed that nested loop seem like the estimates are rather close (index scans with 11 estimated vs 30 actual and 3350 vs 3320)... why does the higher node have such a different estimate vs actual ratio? 


Michael Lewis  |  Software Engineer
Entrata

Re: Reading explain plans- row estimates/actuals on lower nodes vsnext level up

From
Tomas Vondra
Date:
On Thu, Oct 17, 2019 at 03:15:21PM -0600, Michael Lewis wrote:
>https://explain.depesz.com/s/Caa5
>
>I am looking at this explain analyze output and seeing a nested loop
>towards the lowest levels with pretty bad estimate vs actual (2.3k vs 99k),
>but the things that feed that nested loop seem like the estimates are
>rather close (index scans with 11 estimated vs 30 actual and 3350 vs
>3320)... why does the higher node have such a different estimate vs actual
>ratio?
>

This is usually a sign of non-uniform distribution for the join columns,
and/or correlation between sides of the join.

regards

-- 
Tomas Vondra                  http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services