Re: A limit clause can cause a poor index choice

Поиск
Список
Период
Сортировка
От Nick Cleaton
Тема Re: A limit clause can cause a poor index choice
Дата
Msg-id CAFgz3kuMbs=yzwwsdOx0t8FUBuOSnt8xgsDaFB6no8TuR9xk3Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: A limit clause can cause a poor index choice  (Mohamed Wael Khobalatte <mkhobalatte@grubhub.com>)
Список pgsql-general
On Tue, 19 May 2020 at 21:56, Mohamed Wael Khobalatte
<mkhobalatte@grubhub.com> wrote:

> I believe a second ordering, by id desc, will get your query to use the right index, and shouldn't be functionally
differentfrom what you would expect.
 

Thanks, that works nicely on our production table, even with much
larger sets of customer_id values.

> What happens when you raise the limit? Say to a 1000?

A limit of 1000 makes it choose the fast plan. A limit of 100 causes
it to choose the fast plan if I raise the stats target on that column
to 250 or above, otherwise not.



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

Предыдущее
От: pabloa98
Дата:
Сообщение: Re: Q: Comparing PostgreSQL and Oracle
Следующее
От: Nick Cleaton
Дата:
Сообщение: Re: A limit clause can cause a poor index choice