Re: Poor Performance with Distinct Subqueries with EXISTS and EXCEPT

Поиск
Список
Период
Сортировка
От Thomas F.O'Connell
Тема Re: Poor Performance with Distinct Subqueries with EXISTS and EXCEPT
Дата
Msg-id 08D972DD-4480-11D9-A917-000D93AE0944@sitening.com
обсуждение исходный текст
Ответ на Re: Poor Performance with Distinct Subqueries with EXISTS and EXCEPT  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
I wasn't sure whether EXCEPT would create a unique set from among the
results of both queries.

As in, if the first part of the query (before the EXCEPT clause),
without the DISTINCT, yielded

yahoo.com
yahoo.com

would the query reduce that to a single yahoo.com regardless of whether
it showed up in the EXCEPT clause?

-tfo

--
Thomas F. O'Connell
Co-Founder, Information Architect
Sitening, LLC
http://www.sitening.com/
110 30th Avenue North, Suite 6
Nashville, TN 37203-6320
615-260-0005

On Dec 2, 2004, at 10:26 AM, Tom Lane wrote:

> =?iso-8859-15?Q?Pierre-Fr=E9d=E9ric_Caillaud?=
> <lists@boutiquenumerique.com> writes:
>>     I may be mistaken, but you may be doing the same thing twice : you're
>> basically writing :
>
>>     SELECT DISTINCT X WHERE Y EXCEPT SELECT DISTINCT X WHERE NOT Y
>>     Is this not a way to get an empty result set ?
>
> No, because some X values may appear in rows where Y, and also in rows
> where NOT Y.
>
> The DISTINCTs are wastes of time, though, because EXCEPT implies
> elimination of duplicates.
>
>             regards, tom lane


В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Poor Performance with Distinct Subqueries with EXISTS and EXCEPT
Следующее
От: Mario Weilguni
Дата:
Сообщение: Changing column type from oid to int4