Re: Skipping NULL keys when uniqueifying a semijoin's RHS - Mailing list pgsql-hackers

From Dagfinn Ilmari Mannsåker
Subject Re: Skipping NULL keys when uniqueifying a semijoin's RHS
Date
Msg-id 878q5tyrqu.fsf@wibble.ilmari.org
Whole thread
Responses Re: bump minimum supported version of psql and pg_{dump,dumpall,upgrade} to v10
RE: Skipping NULL keys when uniqueifying a semijoin's RHS
List pgsql-hackers
William Bernbaum <wbernbaum@dwdev.com> writes:

> The attached patch adds a pass, add_semijoin_not_null_quals(),
> which runs before set_base_rel_sizes(), that walks
> root->join_info_list, and, for each semijoin whose
> righthand keys can be unique-ified, pushes an IS NOT NULL
> restriction down onto the key.

I'm by no means an expert on the planner, but the idea seems sound to
me, and on the surface the change looks sensible.  I have just a couple
of code nitpicks:

> +    ListCell   *lc;
> +
> +    foreach(lc, root->join_info_list)
> +    {
> +        SpecialJoinInfo *sjinfo = (SpecialJoinInfo *) lfirst(lc);

This should be foreach_node(SpecialJoinInfo, sjinfo, root->join_info_list).

> +        ListCell   *lc2;
[...]
> +        foreach(lc2, sjinfo->semi_rhs_exprs)
> +        {
> +            Expr       *expr = (Expr *) lfirst(lc2);

And this should be foreach_node(Expr, expr, sjinfo->semi_rhs_exprs).

- ilmari



Attachment

pgsql-hackers by date:

Previous
From: Ayush Tiwari
Date:
Subject: Re: Error handling in after-startup shmem requests
Next
From: David Rowley
Date:
Subject: Re: apply worker misses closing partition leaves