Re: Bad query plan decision when using multiple column index - postgresql uses only first column then filters

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Lewis <mlewis(at)entrata(dot)com>
Cc: Cosmin Prund <cprund(at)gmail(dot)com>, Pgsql Performance <pgsql-performance(at)lists(dot)postgresql(dot)org>
Subject: Re: Bad query plan decision when using multiple column index - postgresql uses only first column then filters
Date: 2020-01-16 17:27:39
Message-ID: 2419.1579195659@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Michael Lewis <mlewis(at)entrata(dot)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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Cosmin Prund 2020-01-16 18:15:09 Re: Bad query plan decision when using multiple column index - postgresql uses only first column then filters
Previous Message Cosmin Prund 2020-01-16 17:18:24 Re: Bad query plan decision when using multiple column index - postgresql uses only first column then filters