Re: Re : Re : Query "top 10 and others" - Mailing list pgsql-general

From Merlin Moncure
Subject Re: Re : Re : Query "top 10 and others"
Date
Msg-id CAHyXU0xdvo0GesOxcAPGz=g+1b0MiED_4bRyxEWk2Pn27aqeDA@mail.gmail.com
Whole thread Raw
In response to Re : Re : Query "top 10 and others"  (Edson Richter <edsonrichter@hotmail.com>)
List pgsql-general
On Sat, Jul 5, 2014 at 8:12 AM, Edson Richter <edsonrichter@hotmail.com> wrote:
> Thanks!
>
> I'll investigate (explain) performance for both versions.

also be advised that in most cases when you use SQL 'UNION' you really
should be using 'UNION ALL'.  It's a very common mistake:

UNION: form proper set union, combine set and remove tuple duplicates
UNION ALL: append two sets

For large sets, the duplicate removal can be expensive and possibly
introduce subtle data dependent bugs in the worst case.

merlin


pgsql-general by date:

Previous
From: Kynn Jones
Date:
Subject: Re: Random-looking primary keys in the range 100000..999999
Next
From: Gavin Flower
Date:
Subject: Re: Random-looking primary keys in the range 100000..999999