| From: | Haibo Yan <tristan(dot)yim(at)gmail(dot)com> |
|---|---|
| To: | SCHOEMANS Maxime <maxime(dot)schoemans(at)ulb(dot)be> |
| Cc: | vignesh C <vignesh21(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Damir Belyalov <dam(dot)bel07(at)gmail(dot)com>, jian he <jian(dot)universality(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, SAKR Mahmoud <mahmoud(dot)sakr(at)ulb(dot)be>, Diogo Repas <diogo(dot)repas(at)gmail(dot)com>, Andrey Lepikhov <a(dot)lepikhov(at)postgrespro(dot)ru> |
| Subject: | Re: Implement missing join selectivity estimation for range types |
| Date: | 2026-04-18 04:02:36 |
| Message-ID: | CABXr29HNiiDo9nU-iOgLgWjg_MS=ZheSaq+Waf2i5FDy4GL1rg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Thu, Apr 16, 2026 at 8:13 AM SCHOEMANS Maxime <maxime(dot)schoemans(at)ulb(dot)be>
wrote:
> Hi Haibo,
>
> Attached is v7 with the changes we discussed.
>
> Patch 2 now has an inline comment on the && case explaining the
> outer-bounds approximation and its consistency with existing restriction
> selectivity. The commit message mentions it as well.
>
> Patch 3 uses a separate backend-private header (rangetypes_selfuncs.h)
> instead of selfuncs.h.
>
> Regards,
> Maxime
>
Hi Maxime,
Thanks for the updated series. Overall I do not have major objections to
the direction here.
A few small nits on patch 2:
1. In the commit message, I wonder if “the core algorithm is identical”
is a bit stronger than necessary. Since the main point is that we are
reusing the same approximation based on outer bounds, something like “the
same outer-bounds-based estimator can be reused” might be a bit more
precise.
2. In a few comments, the wording still says just “range”, but in patch
2 we are really dealing with range/multirange combinations. I think it
would be a bit clearer to make that explicit where appropriate, and reserve
“range” for the underlying range-type/bound-comparison level.
3. I think it would be good to add the reverse mixed-direction test as
well, since patch 2 covers multirange × range in addition to range ×
multirange. Something like:
--------------------------------------------------------
explain (costs off)
select count(*)
from test_mr_join_mr a, test_mr_join_r b
where a.mr << b.r;
explain (costs off)
select count(*)
from test_mr_join_mr a, test_mr_join_r b
where a.mr >> b.r;
explain (costs off)
select count(*)
from test_mr_join_mr a, test_mr_join_r b
where a.mr && b.r;
--------------------------------------------------------
I think that would make the mixed-case coverage feel more complete.
Regards,
Haibo
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Xuneng Zhou | 2026-04-18 04:19:50 | Re: test: avoid redundant standby catchup in 049_wait_for_lsn |
| Previous Message | Tatsuya Kawata | 2026-04-18 03:29:19 | [PATCH] Doc: Fix missing func_signature role in pg_get_tablespace_ddl entry |