Re: BUG #18885: ERROR: corrupt MVNDistinct entry - 2
Tomas Vondra <tomas@vondra.me>
From: Tomas Vondra <tomas@vondra.me>
To: Andrei Lepikhov <lepihov@gmail.com>, David Rowley <dgrowleyml@gmail.com>
Cc: tharakan@gmail.com, pgsql-bugs@lists.postgresql.org,
PG Bug reporting form <noreply@postgresql.org>,
Alexander Korotkov <aekorotkov@gmail.com>
Date: 2025-04-15T13:16:42Z
Lists: pgsql-bugs
On 4/15/25 11:41, Andrei Lepikhov wrote: > On 4/14/25 01:26, David Rowley wrote: >> just "continue;". The variable would only be needed if there was some >> inner loop and we couldn't use "continue". > +1 >> * XXX Maybe we should allow searching the expressions even if we >> * found an attribute matching the expression? That would handle >> * trivial expressions like "(a)" but it seems fairly useless. >> */ >> Maybe it meant "matching the Var"? > +1 > > I have read your modification of comments to > estimate_multivariate_ndistinct. It suggested the idea of letting the > GroupVarInfo struct be exported. For now, only add_unique_group_var or > another internal selfuncs.c routine may build this list. > I'm not sure that the GroupVarInfo abstraction is shaped ideally at the > moment, but it seems it may perform duties similar to RestrictInfo but > for grouping keys: store the key, cache data about this key, cache > statistics and estimations. > It would be the first step in letting modules use > estimate_multivariate_ndistinct. Likewise, we can use > statext_clauselist_selectivity and dependencies_clauselist_selectivity. > > What do you think about that? > > P.S. statext_mcv_clauselist_selectivity deserves to be exported, too. > Not sure we'd want to export GroupVarInfo in the current shape. It was meant for a short-lived local state (within a single function), which seems quite different from what RestrictInfo does. In any case, such rework seems out of scope for PG18 - it's much more than a fix for the bug. regards -- Tomas Vondra
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Properly prepare varinfos in estimate_multivariate_bucketsize()
- 9f404d7922e8 18.0 landed
-
Improve comments for estimate_multivariate_ndistinct()
- f3281f9f9395 18.0 landed
-
Use extended stats for precise estimation of bucket size in hash join
- 6bb6a62f3cc4 18.0 cited
-
Ignore nullingrels when looking up statistics
- e28033fe1af8 18.0 cited