Re: Tracking per-RelOptInfo uniqueness during planning

From: Ilia Evdokimov <ilya(dot)evdokimov(at)tantorlabs(dot)com>
To: Richard Guo <guofenglinux(at)gmail(dot)com>, Antonin Houska <ah(at)cybertec(dot)at>
Cc: Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andy Fan <zhihuifan1213(at)163(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com>
Subject: Re: Tracking per-RelOptInfo uniqueness during planning
Date: 2026-08-18 12:31:32
Message-ID: fd0aa274-abf7-497a-9279-2e5adcea14c7@tantorlabs.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Thank you for working on this - I'll be running it through my own
benchmarks as well.

On 8/18/26 04:14, Richard Guo wrote:
> Here is v3 of this patchset.

But first, in v3-0001 `create_partial_unique_paths()` builds
`partial_unique_rel` via memcpy from `input_rel` but never resets the
`unique_keys` field. Unlike the structural fields memcpy legitimately
carries over, `uniquekeys` describes uniqueness of this specific rel's
output - same category as rows/reltarget/pathlist, which the function
already resets - so it should be reset too rather than silently
inherited from `input_rel`. It's harmless today since nothing reads it
there, but it's the kind of state field a future no-op check could pick
up and use wrongly.

planner.c: create_partial_unique_paths()
```
 partial_unique_rel->cheapest_parameterized_paths = NIL;
+partial_unique_rel->uniquekeys = NIL;

 /* Estimate number of output rows */
```

--
Best regards,
Ilia Evdokimov,
Tantor Labs LLC,
https://tantorlabs.com/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrei Lepikhov 2026-08-18 12:36:53 Re: Allow a prosupport function to be attached to an aggregate
Previous Message Andrey Rachitskiy 2026-08-18 11:58:08 Re: Residual cleanups for tied objects in PL/Perl