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

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Miroslav Bendik <miroslav(dot)bendik(at)gmail(dot)com>
Cc: Richard Guo <guofenglinux(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Incremental sort for access method with ordered scan support (amcanorderbyop)
Date: 2023-04-18 09:50:21
Message-ID: CAApHDvqqCpQz1y73W=q0+=t7+KkvVLuGV=ejSCS--=xgt=scuA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 18 Apr 2023 at 19:29, Miroslav Bendik <miroslav(dot)bendik(at)gmail(dot)com> wrote:
> here is an updated patch with proposed changes.

Here's a quick review:

1. I don't think this is required. match_pathkeys_to_index() sets
these to NIL and they're set accordingly by the other code paths.

- List *orderbyclauses;
- List *orderbyclausecols;
+ List *orderbyclauses = NIL;
+ List *orderbyclausecols = NIL;

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));

3. The following 2 changes don't seem to be needed:

@@ -3104,11 +3100,11 @@ match_pathkeys_to_index(IndexOptInfo *index,
List *pathkeys,
/* Pathkey must request default sort order for the target opfamily */
if (pathkey->pk_strategy != BTLessStrategyNumber ||
pathkey->pk_nulls_first)
- return;
+ break;

/* If eclass is volatile, no hope of using an indexscan */
if (pathkey->pk_eclass->ec_has_volatile)
- return;
+ break;

There's no code after the loop you're breaking out of, so it seems to
me that return is the same as break and there's no reason to change
it.

David

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dagfinn Ilmari Mannsåker 2023-04-18 10:27:54 Re: Adding argument names to aggregate functions
Previous Message Jim Jones 2023-04-18 09:16:46 Re: Adding argument names to aggregate functions