From: | Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com> |
---|---|
To: | Corey Huinker <corey(dot)huinker(at)gmail(dot)com> |
Cc: | Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: Statistics Import and Export |
Date: | 2023-12-29 20:14:34 |
Message-ID: | 42d78931-9e7d-ac5e-da68-5440c726e985@enterprisedb.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 12/29/23 17:27, Corey Huinker wrote:
> But maybe it's enough to just do what you did - if we get an MCELEM
> slot, can it ever contain anything else than array of elements of the
> attribute array type? I'd bet that'd cause all sorts of issues, no?
>
>
> Thanks for the explanation of why it wasn't working for me. Knowing that
> the case of MCELEM + is-array-type is the only case where we'd need to
> do that puts me at ease.
>
But I didn't claim MCELEM is the only slot where this might be an issue.
I merely asked if a MCELEM slot can ever contain an array with element
type different from the "original" attribute.
After thinking about this a bit more, and doing a couple experiments
with a trivial custom data type, I think this is true:
1) MCELEM slots for "real" array types are OK
I don't think we allow "real" arrays created by users directly, all
arrays are created implicitly by the system. Those types always have
array_typanalyze, which guarantees MCELEM has the correct element type.
I haven't found a way to either inject my custom array type or alter the
typanalyze to some custom function. So I think this is OK.
2) I'm not sure we can extend this regular data types / other slots
For example, I think I can implement a data type with custom typanalyze
function (and custom compute_stats function) that fills slots with some
other / strange stuff. For example I might build MCV with hashes of the
original data, a CountMin sketch, or something like that.
Yes, I don't think people do that often, but as long as the type also
implements custom selectivity functions for the operators, I think this
would work.
regards
--
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
From | Date | Subject | |
---|---|---|---|
Next Message | Jelte Fennema-Nio | 2023-12-29 23:07:15 | Re: Add new protocol message to change GUCs for usage with future protocol-only GUCs |
Previous Message | Jeff Davis | 2023-12-29 20:10:26 | Re: broken master regress tests |