Re: [planner] Ignore "order by" in subselect if parrent do count(*)

Поиск
Список
Период
Сортировка
От Kevin Grittner
Тема Re: [planner] Ignore "order by" in subselect if parrent do count(*)
Дата
Msg-id 4F4F54910200002500045D59@gw.wicourts.gov
обсуждение исходный текст
Ответ на [planner] Ignore "order by" in subselect if parrent do count(*)  (Marcin Mirosław <marcin@mejor.pl>)
Ответы Re: [planner] Ignore "order by" in subselect if parrent do count(*)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-performance
Marcin Miros*aw<marcin@mejor.pl> wrote:

> SELECT count(*)
>   from (select * from users_profile order by id) u_p;

> "order by id" can be ignored by planner.

This has been discussed before.  Certainly not all ORDER BY clauses
within query steps can be ignored, so there would need to be code to
determine whether it was actually useful, which wouldn't be free,
either in terms of planning time or code maintenance.  It wasn't
judged to be worth the cost.  If you want to avoid the cost of the
sort, don't specify ORDER BY where it doesn't matter.

-Kevin

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

Предыдущее
От: Daniele Varrazzo
Дата:
Сообщение: Bad estimation for "where field not in"
Следующее
От: Jeff Janes
Дата:
Сообщение: Re: PG as in-memory db? How to warm up and re-populate buffers? How to read in all tuples into memory?