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

From David G. Johnston
Subject Re: Why doesn't Postgres apply limit on groups when retrieving N results per group using WHERE IN + ORDER BY
Date
Msg-id CAKFQuwZaoBwC9_fXsaiiU3i3hVSx+mZqabvC8mGUpaCNwk9a7g@mail.gmail.com
Whole thread Raw
In response to Re: Why doesn't Postgres apply limit on groups when retrieving N results per group using WHERE IN + ORDER BY  (Ron Johnson <ronljohnsonjr@gmail.com>)
Responses Re: Why doesn't Postgres apply limit on groups when retrieving N results per group using WHERE IN + ORDER BY  (Sean v <sean@vanmulligen.ca>)
List pgsql-general
On Mon, Feb 5, 2024 at 8:55 AM Ron Johnson <ronljohnsonjr@gmail.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.

pgsql-general by date:

Previous
From: Ron Johnson
Date:
Subject: Re: Why doesn't Postgres apply limit on groups when retrieving N results per group using WHERE IN + ORDER BY
Next
From: Ron Johnson
Date:
Subject: Re: Unused indexes