From: Tom Lane <tgl@sss.pgh.pa.us>
To: easteregg@verfriemelt.org
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15984: order of where in() query affects query planer
Date: Thu, 29 Aug 2019 18:16:45 -0400
Message-ID: <7528.1567117005@sss.pgh.pa.us> (raw)
In-Reply-To: <15984-c0a18aa262593694@postgresql.org>
References: <15984-c0a18aa262593694@postgresql.org>
PG Bug reporting form <noreply@postgresql.org> writes:
> i have a partial index like in the following example and when reorder the
> elements of the in() statement,
> i get sometimes a bitmap indexscan instead of the expected index only scan.
> if i remove an element, i still get the index only,
> but with the wrong order, i get a bitmap heap scan. is this expected?
FWIW, I get the same plan shape with either order of the IN elements.
However, your example is probably going to be subject to plan instability
because
(1) you used vacuum full not plain vacuum. That doesn't leave the table
in the all-visible condition that would favor an index-only scan.
(2) you didn't analyze the table. At some point, autovacuum will come
along and rectify that oversight, likely causing the plan choice to
change underneath you.
regards, tom lane
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, easteregg@verfriemelt.org
Subject: Re: BUG #15984: order of where in() query affects query planer
In-Reply-To: <7528.1567117005@sss.pgh.pa.us>
References: <15984-c0a18aa262593694@postgresql.org> <7528.1567117005@sss.pgh.pa.us>
* 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