Re: How to delete column level Stats/Histogram

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: "Wong, Kam Fook (TR Technology)" <kamfook(dot)wong(at)thomsonreuters(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to delete column level Stats/Histogram
Date: 2024-05-30 22:45:24
Message-ID: CAApHDvp05Q5jw4zqC9TLQqhdJQ9E6kjs=aYMr4DedONsJDPBCg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 31 May 2024 at 09:28, Wong, Kam Fook (TR Technology)
<kamfook(dot)wong(at)thomsonreuters(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Juan Rodrigo Alejandro Burgos Mella 2024-05-31 00:06:03 Re: Dll libpq.dll 32 bits
Previous Message johnlumby@hotmail.com 2024-05-30 22:34:23 Re: Rules and Command Status - update/insert/delete rule with series of commands in action