Re: Why doesn't Postgres apply limit on groups when retrieving N results per group using WHERE IN + ORDER BY

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Why doesn't Postgres apply limit on groups when retrieving N results per group using WHERE IN + ORDER BY
Date: 2024-02-05 15:58:09
Message-ID: CAKFQuwZaoBwC9_fXsaiiU3i3hVSx+mZqabvC8mGUpaCNwk9a7g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Feb 5, 2024 at 8:55 AM Ron Johnson <ronljohnsonjr(at)gmail(dot)com> wrote:

>
> Who knows which users are going to be in that list???
>
>
It doesn't matter. Worse case scenario there is only one user in the
result and so all 50 rows are their earliest 50 rows. The system will thus
never need more than the earliest 50 rows per user to answer this question.

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ron Johnson 2024-02-05 16:03:59 Re: Unused indexes
Previous Message Ron Johnson 2024-02-05 15:54:49 Re: Why doesn't Postgres apply limit on groups when retrieving N results per group using WHERE IN + ORDER BY