From: | Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Andreas Seltenreich <seltenreich(at)gmx(dot)de>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Tomas Vondra <tomas(dot)vondra(at)postgresql(dot)org> |
Subject: | Re: [sqlsmith] Crash in mcv_get_match_bitmap |
Date: | 2019-07-11 15:08:22 |
Message-ID: | 20190711150822.z7cirna2fjtrfcnu@development |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Jul 10, 2019 at 06:48:16PM -0400, Tom Lane wrote:
>Oh ... while we're piling on here, it just sunk into me that
>mcv_get_match_bitmap is deciding what the semantics of an operator
>are by seeing what it's using for a selectivity estimator.
>That is just absolutely, completely wrong. For starters, it
>means that the whole mechanism fails for any operator that wants
>to use a specialized estimator --- hardly an unreasonable thing
>to do. For another, it's going to be pretty unreliable for
>extensions, because I do not think they're all careful about using
>the right estimator --- a lot of 'em probably still haven't adapted
>to the introduction of separate <= / >= estimators, for instance.
>
>The right way to determine operator semantics is to look to see
>whether they are in a btree opclass. That's what the rest of the
>planner does, and there is no good reason for the mcv code to
>do it some other way.
>
Hmmm, but that will mean we're unable to estimate operators that are not
part of a btree opclass. Which is a bit annoying, because that would also
affect equalities (and thus functional dependencies), in which case the
type may easily have just hash opclass or something.
But maybe I just don't understand how the btree opclass detection works
and it'd be fine for sensibly defined operators. Can you point me to code
doing this elsewhere in the planner?
We may need to do something about code in pg10, because functional
dependencies this too (although just with F_EQSEL). But maybe we should
leave pg10 alone, we got exactly 0 reports about it until now anyway.
regards
--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Alexander Korotkov | 2019-07-11 15:08:58 | Re: [HACKERS] [WIP] Effective storage of duplicates in B-tree index. |
Previous Message | Alexander Korotkov | 2019-07-11 15:02:04 | Re: [HACKERS] [WIP] Effective storage of duplicates in B-tree index. |