Re: Postgres 8.4 planner question - bad plan, good plan for almost same queries. - Mailing list pgsql-hackers

From Дмитрий
Subject Re: Postgres 8.4 planner question - bad plan, good plan for almost same queries.
Date
Msg-id 4F69B08E.8040407@ac-sw.com
Whole thread Raw
In response to Re: Postgres 8.4 planner question - bad plan, good plan for almost same queries.  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> I think the reason the planner isn't too bright about this case is
> http://git.postgresql.org/gitweb/?p=postgresql.git&a=commitdiff&h=cd1f0d04bf06938c0ee5728fc8424d62bcf2eef3
> ie, it won't do IN/EXISTS pullup below a NOT EXISTS.
>
> HEAD is better, thanks to commit
> 0816fad6eebddb8f1f0e21635e46625815d690b9, but of course there is no
> chance at all of back-patching the planner changes that depends on.

I found that it works fine for [NOT] EXISTS if I just fold query inside 
into "select 1 from (...) vv". With my provided query, it uses seqscan 
for both EXISTS/NOT EXISTS without folding, and index scan with it.

Okay, it's easier for me to make automatic subquery folding.

Regards,
Dmitry


pgsql-hackers by date:

Previous
From: Kohei KaiGai
Date:
Subject: Re: [v9.2] Add GUC sepgsql.client_label
Next
From: Fujii Masao
Date:
Subject: Re: Scaling XLog insertion (was Re: Moving more work outside WALInsertLock)