public inbox for [email protected]  
help / color / mirror / Atom feed
From: David Rowley <[email protected]>
To: Wong, Kam Fook (TR Technology) <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: How to delete column level Stats/Histogram
Date: Fri, 31 May 2024 10:45:24 +1200
Message-ID: <CAApHDvp05Q5jw4zqC9TLQqhdJQ9E6kjs=aYMr4DedONsJDPBCg@mail.gmail.com> (raw)
In-Reply-To: <CH0PR03MB61008E885DA648855B38E273FEF32@CH0PR03MB6100.namprd03.prod.outlook.com>
References: <CH0PR03MB61008E885DA648855B38E273FEF32@CH0PR03MB6100.namprd03.prod.outlook.com>

On Fri, 31 May 2024 at 09:28, Wong, Kam Fook (TR Technology)
<[email protected]> 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






view thread (3+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: How to delete column level Stats/Histogram
  In-Reply-To: <CAApHDvp05Q5jw4zqC9TLQqhdJQ9E6kjs=aYMr4DedONsJDPBCg@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox