Re: BUG #15984: order of where in() query affects query planer

From: easteregg(at)verfriemelt(dot)org
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15984: order of where in() query affects query planer
Date: 2019-09-02 09:28:07
Message-ID: 20190902092807.0e0770b0@mail.verfriemelt.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

i have created another example for you, were i get consistent results after the analyse with the different plans:

create table test( a int, b int, c int );
insert into test
select random()*100, random()*10, random()*5 FROM generate_series(1,1000000);
create index "full" on test( a, c );
create index "partial" on test( a, c ) where ( a in ( 3,4,5,6,7,8,9,10 ) and b in ( 2,3 ) );
analyse test;

explain analyse select * from test where a in ( 3,4,5,6,7,8,9,10 ) and b in ( 2,3 );

explain analyse select * from test where a in ( 3,4,5,6,7,8,10,9 ) and b in ( 2,3 );

do i have wrong expections from theryplanner, that those are in fact two different paths to take? currently i work around this issue by sorting the elements for the in statements, but i think that must be the wrong path.

with kind regards, richard

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2019-09-02 13:53:47 BUG #15989: Cluster unable to open as hot standby after SIGKILL during exclusive backup
Previous Message Tom Lane 2019-09-01 15:36:25 Re: BUG #15987: Improve REINDEX of all indexes of a table at once