Re: query produces 1 GB temp file

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: query produces 1 GB temp file
Дата
Msg-id 4859.1107710214@sss.pgh.pa.us
обсуждение исходный текст
Ответ на query produces 1 GB temp file  (Dirk Lutzebaeck <lutzeb@aeccom.com>)
Ответы Re: query produces 1 GB temp file  (Dirk.Lutzebaeck@t-online.de (Dirk Lutzebaeck))
Список pgsql-performance
Dirk.Lutzebaeck@t-online.de (Dirk Lutzebaeck) writes:
> SELECT DISTINCT ON (df.val_9, df.created, df.flatid) df.docindex,
> df.flatobj, bi.oid, bi.en
> FROM bi,df
> WHERE bi.rc=130170467
> ...
> ORDER BY df.val_9 ASC, df.created DESC
> LIMIT 1000 OFFSET 0

Just out of curiosity, what is this query supposed to *do* exactly?
It looks to me like it will give indeterminate results.  Practical
uses of DISTINCT ON generally specify more ORDER BY columns than
there are DISTINCT ON columns, because the extra columns determine
which rows have priority to survive the DISTINCT filter.  With the
above query, you have absolutely no idea which row will be output
for a given combination of val_9/created/flatid.

            regards, tom lane

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

Предыдущее
От: Steven Rosenstein
Дата:
Сообщение: Are JOINs allowed with DELETE FROM
Следующее
От: Gaetano Mendola
Дата:
Сообщение: Re: Are JOINs allowed with DELETE FROM