Re: Ordering in an aggregate -- points to paths

Поиск
Список
Период
Сортировка
От Julian Scarfe
Тема Re: Ordering in an aggregate -- points to paths
Дата
Msg-id 039401c3335d$f94d1760$0600a8c0@Wilbur
обсуждение исходный текст
Ответ на Ordering in an aggregate -- points to paths  ("Julian Scarfe" <julian.scarfe@ntlworld.com>)
Список pgsql-sql
From: "Tom Lane" <tgl@sss.pgh.pa.us>

> Yeah, this is a fairly obvious thing to want to do with a user-written
> aggregate.  It does not work in released versions, because the planner
> does not notice that the inner SELECT's output ordering matches what
> the GROUP BY needs, and so it inserts an additional Sort plan step
> above the sub-select (you can see this if you look at EXPLAIN output).
> Unfortunately, on most platforms qsort() isn't stable and will not
> preserve the ordering of its input for equal keys.  So you lose the
> minor ordering by seq_no in the re-sort.

Most grateful for the rapid response Tom. Knowing that, I can work around by
iterating through the firs at the application level.

Regards

Julian Scarfe

PS: you shouldn't be working on a Sunday, it's bad for you ;-)





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

Предыдущее
От: Emmanuel Engelhart
Дата:
Сообщение: UNION & LIMIT & ORDER BY
Следующее
От: Bruno Wolff III
Дата:
Сообщение: Re: date question