Re: Incremental sort for access method with ordered scan support (amcanorderbyop)

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Miroslav Bendik <miroslav(dot)bendik(at)gmail(dot)com>
Cc: David Rowley <dgrowleyml(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Incremental sort for access method with ordered scan support (amcanorderbyop)
Date: 2023-06-25 08:18:33
Message-ID: CAMbWs485qtMApvWmO5brUmPHM1yx0z=zZUPGob6PkVpLu861Dw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Apr 20, 2023 at 9:37 PM Miroslav Bendik <miroslav(dot)bendik(at)gmail(dot)com>
wrote:

> Thanks for this fix. Now the version
> am_orderbyop_incremental_sort_v3.1.patch [1] works without issues
> using the master branch.

The v3.1 patch looks good to me, except that the comments around
match_pathkeys_to_index still need some polish.

1. For comment "On success, the result list is ordered by pathkeys.", I
think it'd be more accurate if we say something like "On success, the
result list is ordered by pathkeys or a prefix list of pathkeys."
considering the possibility of incremental sort.

2. The comment below is not true anymore.

/*
* Note: for any failure to match, we just return NIL immediately.
* There is no value in matching just some of the pathkeys.
*/

We should either remove it or change it to emphasize that we may return
a prefix of the pathkeys for incremental sort.

BTW, would you please add the patch to the CF to not lose track of it?

Thanks
Richard

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Banck 2023-06-25 09:10:00 Re: Stampede of the JIT compilers
Previous Message Richard Guo 2023-06-25 06:05:05 Re: postgres_fdw: wrong results with self join + enable_nestloop off