On Fri, 31 May 2024 at 09:28, Wong, Kam Fook (TR Technology)
<kamfook.w...@thomsonreuters.com> wrote:
> Is there a way to delete a specific column level stats/histogram.  The 
> following approach does not work.
>
> alter table abc alter column bg_org_partner set statistics 0;
> analyze   abc;

You'd have to:

DELETE FROM pg_statistic WHERE starelid = 'abc'::regclass and
staattnum = (SELECT attnum FROM pg_attribute WHERE attrelid =
'abc'::regclass AND attname = 'bg_org_partner');

to get rid of it.

David


Reply via email to