| From: | Raj Gandhi <raj01gandhi(at)gmail(dot)com> |
|---|---|
| To: | pgsql-admin(at)postgresql(dot)org |
| Cc: | pgsql-performance(at)postgresql(dot)org |
| Subject: | Re: LIMIT OFFSET with DB view vs plain SQL |
| Date: | 2019-03-28 22:43:45 |
| Message-ID: | CALU_HCPRYnxGdEJnY6AySAyMHTxyHMF=uOv40Esfes5cWg+qPQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-admin pgsql-performance |
+ pgsql-performance
On Thu, Mar 28, 2019 at 6:41 PM Raj Gandhi <raj01gandhi(at)gmail(dot)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
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Laurenz Albe | 2019-03-29 13:53:10 | Re: LIMIT OFFSET with DB view vs plain SQL |
| Previous Message | Raj Gandhi | 2019-03-28 22:41:13 | LIMIT OFFSET with DB view vs plain SQL |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Laurenz Albe | 2019-03-29 13:53:10 | Re: LIMIT OFFSET with DB view vs plain SQL |
| Previous Message | Raj Gandhi | 2019-03-28 22:41:13 | LIMIT OFFSET with DB view vs plain SQL |