Corey Huinker <corey.huinker@gmail.com> writes:
>> I wonder whether we ought to issue different queries depending on
>> whether we're superuser. The pg_stats view is rather expensive
>> because of its security restrictions, and if we're superuser we
>> could just look directly at pg_statistic. Maybe those checks are
>> fast enough not to matter, but ...
> That could lead to a rather complicated query that has to replicate the
> guts of pg_stats for every server-specific version of pg_stats,
> specifically the CASE statements that transform
> the stakindN/stanumbersN/stavaluesN to mcv, correlation, etc, so I'd like
> to avoid that if possible.
Yeah, it'd be notationally ugly for sure. Let's keep that idea in the
back pocket and see how far we get with the other ideas.
regards, tom lane