1) I want to test my own selectivity function against
future stats collector. Is this a right way to update statistic used by
planner ? update pg_statistic set
stadistinct=4,stakind3=11111,stanumbers3=array[0.8,0.2],stavalues3=array[10000,10001]
where starelid=950855 and staattnum = 21; stadistinct values total, stakind3 is my custom
STATISTIC_KIND, stanumber3 are frequencies of stavalues3. 2) How to add custom statistic kind for 1-dim array of
integers (_int4) ? Currently it uses standard compute_scalar_stats (commands/analyze.c). Custom statistic is needed to count selectivity for
GIST built by contrib/intarray. It should be gathered only for 1-dim arrays and
contain most-common values met in among all arrays, Distinct values among all arrays etc. Generally, it can be gathered on anyarray(not only
_int4), but it’s ok for me (yet) to have it working for _int4 1-dim only. Pitifully, I have no idea what is the right way of
putting such thing into existing system.. Should I add switches into analyze.c or there exist a
better way ? Maybe one could sketch out the structure of what is
to be done… |