Re: How to delete column level Stats/Histogram - Mailing list pgsql-general

From David Rowley
Subject Re: How to delete column level Stats/Histogram
Date
Msg-id CAApHDvp05Q5jw4zqC9TLQqhdJQ9E6kjs=aYMr4DedONsJDPBCg@mail.gmail.com
Whole thread Raw
In response to How to delete column level Stats/Histogram  ("Wong, Kam Fook (TR Technology)" <kamfook.wong@thomsonreuters.com>)
List pgsql-general
On Fri, 31 May 2024 at 09:28, Wong, Kam Fook (TR Technology)
<kamfook.wong@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



pgsql-general by date:

Previous
From: "johnlumby@hotmail.com"
Date:
Subject: Re: Rules and Command Status - update/insert/delete rule with series of commands in action
Next
From: Juan Rodrigo Alejandro Burgos Mella
Date:
Subject: Re: Dll libpq.dll 32 bits