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

From: Дмитрий <fozzy(at)ac-sw(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Postgres 8.4 planner question - bad plan, good plan for almost same queries.
Date: 2012-03-21 10:42:22
Message-ID: 4F69B08E.8040407@ac-sw.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2012-03-21 11:14:28 Re: Scaling XLog insertion (was Re: Moving more work outside WALInsertLock)
Previous Message Kohei KaiGai 2012-03-21 10:07:24 Re: [v9.2] Add GUC sepgsql.client_label