Re: Implement missing join selectivity estimation for range types - Mailing list pgsql-hackers

From SCHOEMANS Maxime
Subject Re: Implement missing join selectivity estimation for range types
Date
Msg-id DB8P190MB0731FF1A358E9AB16FB1F14FF0252@DB8P190MB0731.EURP190.PROD.OUTLOOK.COM
Whole thread Raw
In response to Re: Implement missing join selectivity estimation for range types  (Haibo Yan <tristan.yim@gmail.com>)
Responses Re: Implement missing join selectivity estimation for range types
List pgsql-hackers
Hi Haibo,

Thank you for picking this up again. I agree with the changes you made
in v5, in particular scoping the patch to the three strict operators and
reworking the tests to check plan structure rather than exact row counts.

Attached is v6 as a 3-patch series building on your v5.

Patch 1 is your range join selectivity patch with one small change: the
range_cmp_bounds result in the merge walk is stored in a local cmp
variable to avoid calling it twice per iteration, as jian he suggested.

Patch 2 adds the same estimation for multirange types, covering all type
combinations (multirange x multirange, multirange x range, range x
multirange). Since both range and multirange types use the same bound
histogram format and the same RangeBound representation, the core
algorithm is identical.

Patch 3 removes the duplication between rangetypes_selfuncs.c and
multirangetypes_selfuncs.c that Tom raised as a concern. It makes the
10 shared helper functions non-static, exports them via selfuncs.h,
and deletes the copies from the multirange file. This covers all the
pre-existing duplication between the two files, not just the functions
added in this patch set.

Regards,
Maxime
Attachment

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Adding REPACK [concurrently]
Next
From: Aleksander Alekseev
Date:
Subject: Re: [PATCH] Refactor *_abbrev_convert() functions