From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Lewis <mlewis@entrata.com>
Cc: Cosmin Prund <cprund@gmail.com>
Cc: Pgsql Performance <pgsql-performance@lists.postgresql.org>
Subject: Re: Bad query plan decision when using multiple column index - postgresql uses only first column then filters
Date: Thu, 16 Jan 2020 12:27:39 -0500
Message-ID: <2419.1579195659@sss.pgh.pa.us> (raw)
In-Reply-To: <CAHOFxGpHTpPDAJKj1MtwmJSQ266_0vXwRnJbAbQ=ah73h2r27w@mail.gmail.com>
References: <CAGU4dz_tvnjJB3OEgErzt6V1PHACH0WqxwFFoMm+5bCNvjrF4g@mail.gmail.com>
<19059.1579187486@sss.pgh.pa.us>
<CAHOFxGpHTpPDAJKj1MtwmJSQ266_0vXwRnJbAbQ=ah73h2r27w@mail.gmail.com>
Michael Lewis <mlewis@entrata.com> writes:
> Does the behavior change with different values of Ver column?
By and large, indxpath.c will just add all qual clauses that match
an index to the indexscan's conditions --- there's no attempt to
decide that some of them might not be worth it on cost grounds.
So I'd be pretty surprised if altering the Ver constant made any
difference. My money is on there being some reason why the IN
clause doesn't match the index, perhaps a type mismatch. Without
seeing the table schema, and the exact query, it's hard to say what
that reason is. (I'll not insult your intelligence by saying how
I know that the OP didn't just copy-and-paste that query.)
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 using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: tgl@sss.pgh.pa.us, mlewis@entrata.com, cprund@gmail.com, pgsql-performance@lists.postgresql.org
Subject: Re: Bad query plan decision when using multiple column index - postgresql uses only first column then filters
In-Reply-To: <2419.1579195659@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