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

2023-07-03 Thread Miroslav Bendik
Thanks, for suggestions. On Sun 02. 07. 2023 at 10:18 Richard Guo wrote: > 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." > consider

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

2023-04-20 Thread Miroslav Bendik
> I've just pushed a fix to master for this. See [1]. If you base your > patch atop of that you should be able to list list_copy_head() without > any issues. Thanks for this fix. Now the version am_orderbyop_incremental_sort_v3.1.patch [1] works without issues using the master branch. [1] https

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

2023-04-19 Thread Miroslav Bendik
Sorry for spamming, but I found a more elegant way to check if query_paths is NIL without modified list_copy_head. Here is a third iteration of this patch. -- Miroslav diff --git a/src/backend/optimizer/path/indxpath.c b/src/backend/optimizer/path/indxpath.c index b8000da56d..735b41552a 100644 -

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

2023-04-19 Thread Miroslav Bendik
Thanks for feedback > 2. You can use list_copy_head(root->query_pathkeys, > list_length(orderbyclauses)); instead of: > > + useful_pathkeys = list_truncate(list_copy(root->query_pathkeys), > + list_length(orderbyclauses)); This code will crash if query_pathkeys is NIL. I need either modify li

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

2023-04-18 Thread Miroslav Bendik
po 17. 4. 2023 o 15:26 Richard Guo napísal(a): > > > On Sun, Apr 16, 2023 at 1:20 AM Miroslav Bendik > wrote: >> >> Postgres allows incremental sort only for ordered indexes. Function >> build_index_paths dont build partial order paths for access methods >&g

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

2023-04-15 Thread Miroslav Bendik
Current version of postgresql don't support incremental sort using ordered scan on access method. Example database: CREATE TABLE t (id serial, p point, PRIMARY KEY(id)); INSERT INTO t (SELECT generate_series(1, 1000), point(random(), random())); CREATE INDEX p_idx ON t USING gist(p); ANALYZE;