Re: Plan not skipping unnecessary inner join

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org, hippysoyboy(at)gmail(dot)com, postgres(at)binarykeep(dot)com
Subject: Re: Plan not skipping unnecessary inner join
Date: 2020-05-17 13:31:24
Message-ID: 20200517133124.GB18456@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Sun, May 17, 2020 at 09:32:47AM -0300, Ranier Vilela wrote:
> I redid the same tests with vanila postgres and with empty tables.
> I'm surprised, why does the plan have 2550 rows in explain?

That's the *estimated* rowcount.

The planner tends to ignore table statistics which say the table is empty,
since that can lead to a terrible plan if it's not true (stats are out of date
or autovacuum threshold not hit).

See also here
https://www.postgresql.org/message-id/20171110204043.GS8563%40telsasoft.com

--
Justin

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Ranier Vilela 2020-05-17 14:05:39 Re: Plan not skipping unnecessary inner join
Previous Message Ranier Vilela 2020-05-17 12:32:47 Re: Plan not skipping unnecessary inner join