Re: Properly pathify the union planner

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Andy Fan <zhihuifan1213(at)163(dot)com>
Cc: Richard Guo <guofenglinux(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Properly pathify the union planner
Date: 2024-02-15 05:03:43
Message-ID: CAApHDvoXPZ0K2HPwumz2B-ptfsbdyTb1esF3OO6-_JuKYWziAw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 7 Feb 2024 at 12:05, Andy Fan <zhihuifan1213(at)163(dot)com> wrote:
> +static int
> +pathkeys_useful_for_setop(PlannerInfo *root, List *pathkeys)
> +{
> + int n_common_pathkeys;
> +
> + if (root->setop_pathkeys == NIL)
> + return 0; /* no special setop ordering requested */
> +
> + if (pathkeys == NIL)
> + return 0; /* unordered path */
> +
> + (void) pathkeys_count_contained_in(root->setop_pathkeys, pathkeys,
> + &n_common_pathkeys);
> +
> + return n_common_pathkeys;
> +}
>
> The two if-clauses looks unnecessary, it should be handled by
> pathkeys_count_contained_in already. The same issue exists in
> pathkeys_useful_for_ordering as well. Attached patch fix it in master.

I agree. I'd rather not have those redundant checks in
pathkeys_useful_for_setop(), and I do want those functions to be as
similar as possible. So I think adjusting it in master is a good
idea.

I've pushed your patch.

David

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2024-02-15 05:05:13 Re: index prefetching
Previous Message Andres Freund 2024-02-15 05:03:11 Re: index prefetching