| From: | Gregory Stark <stark(at)enterprisedb(dot)com> |
|---|---|
| To: | "Decibel!" <decibel(at)decibel(dot)org> |
| Cc: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>, "Simon Riggs" <simon(at)2ndquadrant(dot)com>, <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: IN vs EXISTS equivalence |
| Date: | 2008-08-11 20:40:14 |
| Message-ID: | 87ej4vxp3l.fsf@oxford.xeocode.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
"Decibel!" <decibel(at)decibel(dot)org> writes:
> On Aug 8, 2008, at 3:23 PM, Tom Lane wrote:
>> * has no set operations (UNION etc), grouping, set-returning functions
>> in the SELECT list, LIMIT, or a few other funny cases
>
>
> Couldn't union/union all be treated as
>
> EXISTS(a)
> OR EXISTS(b)
Kind of confused by what you mean here. Can you give an example?
The usual transformation to consider with UNION is to transform
SELECT ... WHERE x OR y
into
SELECT ...
WHERE x
UNION ALL
SELECT ...
WHERE y AND NOT x
(modulo handling NULLs properly)
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
Ask me about EnterpriseDB's RemoteDBA services!
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Alvaro Herrera | 2008-08-11 22:42:08 | Re: autovacuum and TOAST tables |
| Previous Message | Jaime Casanova | 2008-08-11 19:54:29 | Re: Column level privileges was:(Re: Extending grant insert on tables to sequences) |