Re: Reversing NULLS in ORDER causes index not to be used?
В списке pgsql-performance по дате отправления:
| От | Tom Lane |
|---|---|
| Тема | Re: Reversing NULLS in ORDER causes index not to be used? |
| Дата | |
| Msg-id | 226299.1608343379@sss.pgh.pa.us обсуждение |
| Ответ на | Reversing NULLS in ORDER causes index not to be used? (Ken Tanzer <ken.tanzer@gmail.com>) |
| Ответы |
Re: Reversing NULLS in ORDER causes index not to be used?
|
| Список | pgsql-performance |
Ken Tanzer <ken.tanzer@gmail.com> writes:
> Hi. I'm wondering if this is normal or at least known behavior?
> Basically, if I'm specifying a LIMIT and also NULLS FIRST (or NULLS LAST
> with a descending sort), I get a sequence scan and a couple of orders of
> magnitude slower query. Perhaps not relevantly, but definitely ironically,
> the sort field in question is defined to be NOT NULL.
The index won't get credit for matching the requested ordering if it's
got the wrong null-ordering polarity. There's not an exception for
NOT NULL columns. If you know the column hasn't got nulls, why are
you bothering with a nondefault null-ordering request?
regards, tom lane
В списке pgsql-performance по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера