Re: How does postgres behave if several indexes have (nearly) identical conditions?

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Koen De Groote <kdg(dot)dev(at)gmail(dot)com>
Cc: PostgreSQL General <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: How does postgres behave if several indexes have (nearly) identical conditions?
Date: 2021-09-08 21:17:16
Message-ID: CAKFQuwYHXNpySLfhqnd2hymximAFxTT1ad9vod9Lh4FG2rTNgw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wednesday, September 8, 2021, Koen De Groote <kdg(dot)dev(at)gmail(dot)com> wrote:

>
>
> create index index_001 on my_table using btree (a001,a002,a003) where
> a001=true and a002=false;
>
> create index index_002 on my_table using btree (a003) where a001=true and
> a002=false;
>
> Now take this query:
>
> select * from my_table where a001=true;
>
> Which index will postgres pick? I'm wondering how postgres goes about
> picking an index to consider.
>

Neither…since neither partial index condition is present in the where
clause of the query.

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Celia McInnis 2021-09-08 21:18:47 spiexceptions.UndefinedFile: could not open file "base/16482/681830": No such file or directory
Previous Message Koen De Groote 2021-09-08 21:15:00 Re: How does postgres behave if several indexes have (nearly) identical conditions?