Re: LIMIT OFFSET with DB view vs plain SQL

Поиск
Список
Период
Сортировка
От Raj Gandhi
Тема Re: LIMIT OFFSET with DB view vs plain SQL
Дата
Msg-id CALU_HCPRYnxGdEJnY6AySAyMHTxyHMF=uOv40Esfes5cWg+qPQ@mail.gmail.com
обсуждение исходный текст
Ответ на LIMIT OFFSET with DB view vs plain SQL  (Raj Gandhi <raj01gandhi@gmail.com>)
Ответы Re: LIMIT OFFSET with DB view vs plain SQL  (Merlin Moncure <mmoncure@gmail.com>)
Re: LIMIT OFFSET with DB view vs plain SQL  (Merlin Moncure <mmoncure@gmail.com>)
Re: LIMIT OFFSET with DB view vs plain SQL  (Ramón Bastidas <ramon.r.bastidas@gmail.com>)
Re: LIMIT OFFSET with DB view vs plain SQL  (Ramón Bastidas <ramon.r.bastidas@gmail.com>)
Список pgsql-admin
+ pgsql-performance 

On Thu, Mar 28, 2019 at 6:41 PM Raj Gandhi <raj01gandhi@gmail.com> wrote:

Hi everyone,

 

I’m using LIMIT offset with DB view. Looks like query planner is applying the LIMIT for DB view at the end after processing all rows.

When running same SQL that was used to create the DB view, LIMIT is applied earlier so the query is much faster.

 

Explain plan using DB view

https://explain.depesz.com/s/gzjQ

 

Explain plan using raw SQL

https://explain.depesz.com/s/KgwO

 

In both tests LIMIT was 100 with offset  = 0.

Is there any way to force DB view to apply limit earlier?

 

Thanks,

Raj

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

Предыдущее
От: Raj Gandhi
Дата:
Сообщение: LIMIT OFFSET with DB view vs plain SQL
Следующее
От: Laurenz Albe
Дата:
Сообщение: Re: LIMIT OFFSET with DB view vs plain SQL