Re: Efficient pagination using multi-column cursors

From: large(dot)goose2829(at)salomvary(dot)com
To: pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Re: Efficient pagination using multi-column cursors
Date: 2025-03-17 19:52:31
Message-ID: 8a919391-8510-442b-b020-f9a9f4e80fbb@app.fastmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Folks, thanks everyone for the valuable inputs, I think I more-or-less understand now what the options are for my particular problem.

On Wed, Feb 26, 2025, at 17:14, Peter Geoghegan wrote:
> On Wed, Feb 26, 2025 at 10:40 AM <large(dot)goose2829(at)salomvary(dot)com> wrote:
> > Does this mean that it is not possible to come up with a plan that has the same performance as "WHERE (col_1, col_2, col_3) > (10, 20, 29)" using "handwritten" filters, or only for "mixed order"? Or not a theoretical limitation but a limitation of the current implementation of the query planner?
>
> Perhaps the query planner should be taught to rewrite the query in
> such a way as to make it unnecessary for you to do so -- I think that
> that's what MySQL is doing for you. That is beside the point.

Would it make sense to file a feature request for PostgreSQL to implement that MySQL-like optimization mentioned earlier?

On Wed, Feb 26, 2025, at 17:15, Laurenz Albe wrote:
> Here are my ideas for this situation:
>
> https://www.cybertec-postgresql.com/en/keyset-pagination-with-descending-order/

Laurenz, your post is a goldmine of advanced solutions, thanks for sharing.

Cheers,
Márton

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Marcos Pegoraro 2025-03-17 20:52:38 Re: Re: proposal: schema variables
Previous Message Pavel Stehule 2025-03-17 18:32:59 Re: Re: proposal: schema variables