Greg Stark <greg.stark@enterprisedb.com> writes:
> That might only be the case when the pg_statistic record is in shared
> buffers.
Yeah, it seems unlikely that disabling compression is a good idea in the
bigger scheme of things.
> Also I wonder if eqjoinsel and company might need to be made more
> toast-aware by detoasring all the things it needs once rather than
> every time it accesses them.
At least in this example, the same stats arrays are fetched multiple
times per query. It might be worth teaching the planner to cache those
results internally during a plan cycle --- this would avoid most of the
complexity associated with caching (ie, figuring out when to clear the
cache) and still get maybe a 2x or 3x or so win.
regards, tom lane