Re: Evaluation of secondary sort key.

Поиск
Список
Период
Сортировка
От Jesper Krogh
Тема Re: Evaluation of secondary sort key.
Дата
Msg-id 4DA0AB2B.9050408@krogh.cc
обсуждение исходный текст
Ответ на Re: Evaluation of secondary sort key.  (David Fetter <david@fetter.org>)
Список pgsql-hackers
On 2011-04-09 20:00, David Fetter wrote:
> Given the horrors query generators perpetrate, it might be worth
> dropping provably redundant ORDER BYs on the floor at planning time.
Well, many people often add a secondary sort-key to their SQL
for the only purpose of obtainting a consistent result in the
corner-cases where the first sort key is ambiguios.

If the first sort-key isn't planned to be supported by an index-scan,
then you'll end up calculating the second sortkey for the entire
dataset even if you end up doing a "limit 100" at the end.

You can only deem it redundant if there is a primary key in front.
if you have a primary key in front, where as a fix may be really
good in cases where you have a "n_distinct" at or near -1 in pg_stats
for the column.

Jesper
-- 
Jesper


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

Предыдущее
От: Joshua Berkus
Дата:
Сообщение: Feature request: pg_basebackup --force
Следующее
От: Jesper Krogh
Дата:
Сообщение: Re: Evaluation of secondary sort key.