From: | Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com> |
---|---|
To: | Greg Stark <gsstark(at)mit(dot)edu> |
Cc: | Jeff Davis <pgsql(at)j-davis(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Scott Bailey <artacus(at)comcast(dot)net>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Overhead of union versus union all |
Date: | 2009-07-10 17:50:21 |
Message-ID: | dcc563d10907101050t4ae7e12kc3b5f94a8696670c@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, Jul 10, 2009 at 11:47 AM, Greg Stark<gsstark(at)mit(dot)edu> wrote:
> On Fri, Jul 10, 2009 at 6:37 PM, Jeff Davis<pgsql(at)j-davis(dot)com> wrote:
>>
>> -- foo has a primary key
>> SELECT * FROM foo UNION SELECT * FROM foo;
>>
>> That's logically equivalent to:
>>
>> SELECT * FROM foo;
>>
>> But postgresql will add a sort anyway.
>
>
> Well no, it's equivalent to SELECT DISTINCT * FROM foo;
And honestly, I'd rather see development effort go into making complex
queries run faster (the things like bitmap indexes on disk etc) rather
than optimising things that i can optimise myself.
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Davis | 2009-07-10 17:51:47 | Re: Overhead of union versus union all |
Previous Message | artacus | 2009-07-10 17:48:38 | Re: XML import with DTD |