From: Justin Pryzby <pryzby@telsasoft.com>
To: Ranier Vilela <ranier.vf@gmail.com>
Cc: pgsql-performance@postgresql.org
Cc: hippysoyboy@gmail.com
Cc: postgres@binarykeep.com
Subject: Re: Plan not skipping unnecessary inner join
Date: Sun, 17 May 2020 08:31:24 -0500
Message-ID: <20200517133124.GB18456@telsasoft.com> (raw)
In-Reply-To: <CAEudQAo8HdPhqdg85BPn4qRsyY2Ep4PY7nNKJ29ZtzZqueAkKA@mail.gmail.com>
References: <CAEudQAo8HdPhqdg85BPn4qRsyY2Ep4PY7nNKJ29ZtzZqueAkKA@mail.gmail.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: pryzby@telsasoft.com, ranier.vf@gmail.com, hippysoyboy@gmail.com, postgres@binarykeep.com
Subject: Re: Plan not skipping unnecessary inner join
In-Reply-To: <20200517133124.GB18456@telsasoft.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox