Re: How does postgres behave if several indexes have (nearly) identical conditions? - Mailing list pgsql-general

From David G. Johnston
Subject Re: How does postgres behave if several indexes have (nearly) identical conditions?
Date
Msg-id CAKFQuwYHXNpySLfhqnd2hymximAFxTT1ad9vod9Lh4FG2rTNgw@mail.gmail.com
Whole thread Raw
In response to How does postgres behave if several indexes have (nearly) identical conditions?  (Koen De Groote <kdg.dev@gmail.com>)
List pgsql-general


On Wednesday, September 8, 2021, Koen De Groote <kdg.dev@gmail.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.
 

pgsql-general by date:

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