| От | Tom Lane |
|---|---|
| Тема | Re: Sort order in sub-select |
| Дата | |
| Msg-id | 20650.1151648466@sss.pgh.pa.us обсуждение |
| Ответ на | Sort order in sub-select ("Craig A. James" <cjames@modgraph-usa.com>) |
| Список | pgsql-performance |
"Craig A. James" <cjames@modgraph-usa.com> writes:
> insert into hitlist(p_id, sortorder)
> (select p_id, nextval('hitlist_seq') from
> (select p_id, min(data) as m from c group by p_id order by m);
> Apparently, the sort order returned by the innermost select is NOT
> maintained as you go through the next select statement -- the rows seem
> to come out in random order. This surprised me.
It surprises me too. This is outside the SQL spec, because the spec
doesn't allow ORDER BY in subselects, but Postgres definitely does and
we expect it to be honored. Can you provide a complete example and the
EXPLAIN plan that you're getting?
regards, tom lane
В списке pgsql-performance по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера