Re: NULLS LAST performance

Поиск
Список
Период
Сортировка
От Mathieu De Zutter
Тема Re: NULLS LAST performance
Дата
Msg-id AANLkTinfUrhYOxiQs4-+xA95rjJEBwkLQRT9RsQPxJ__@mail.gmail.com
обсуждение исходный текст
Ответ на Re: NULLS LAST performance  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: NULLS LAST performance
Список pgsql-performance

On Wed, Feb 23, 2011 at 10:37 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Merlin Moncure <mmoncure@gmail.com> writes:
> you can always do this:

> create index performance_creation_date_desc_idx on
> performance(creation_date desc nulls last);

> which will index optimize your sql.  Interesting that 'null last'
> fools disallows index usage even when the index was created with
> nullls last as the default.

The problem is that his query needs to scan the index in DESC order,
which means it's effectively NULLS FIRST, which doesn't match the
requested sort order.
 
Merlin, Tom,

Thanks for explaining the behavior!

Any chance that the planner could get smarter about this? In my naive view, it would just be telling the planner that it can disregard "NULLS" when searching for an index, in case the column is known to be NOT NULL.

Kind regards,
Mathieu

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

Предыдущее
От: "Pierre C"
Дата:
Сообщение: Re: performance issue in the fields.
Следующее
От: "Gnanakumar"
Дата:
Сообщение: Function execution consuming lot of memory and eventually making server unresponsive