Robert Haas <robertmhaas@gmail.com> wrote:
> >> Works for me. Especially if you want to think more about ANALYZE before
> >> changing that.
> >
> > Well, it's something that would be sane to contemplate adding in 8.4.
> > It's way too late for any of this other stuff to happen in this release.
>
> I'm thinking about trying to implement this, unless someone else is
> already planning to do it. I'm not sure it's practical to think about
> getting this into 8.4 at this point, but it's worth doing whether it
> does or not.
Can we use get_relation_stats_hook on 8.4? The pg_statistic catalog
will be still modified by ANALYZEs, but we can rewrite the statistics
just before it is used.
your_relation_stats_hook(root, rte, attnum, vardata)
{ Call default implementation; if (rte->relid = YourRelation && attnum = YourColumn) ((Form_pg_statistic)
(vardata->statsTuple))->stadistinct= YourNDistinct;
}
Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center