pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Hotmail <crajac66@hotmail.com>
To: Pgsql-admin <pgsql-admin@lists.postgresql.org>
Subject: Is there a way to correct an inaccurate n_distinct value for extended statistics in PG11?
Date: Fri, 9 Oct 2020 10:35:03 -0600
Message-ID: <BYAPR06MB40235AC790D12757F765CDBFD7080@BYAPR06MB4023.namprd06.prod.outlook.com> (raw)
References: <8f314df0-0ee5-452c-8dc6-8627b29acb48@Spark>

Hi All,

We have created extended statistics between two columns on a large table. When looking at pg_statistic_ext the value for n_distinct for the combined columns is off of the actual number of distinct values  by approixmately 40%. This is leading to a poor choice of leading tables in some of our joins.

With single column statistics inaccurate n_distinct values can be corrected with "alter table alter column set n_distinct ="

Is there a way to fix incorrect n_distinct values for extended statisitics?

Thanks,

Craig Jackson

Message-ID: <BYAPR06MB40235AC790D12757F765CDBFD7080@BYAPR06MB4023.namprd06.prod.outlook.com>
Permalink:  ../BYAPR06MB40235AC790D12757F765CDBFD7080@BYAPR06MB4023.namprd06.prod.outlook.com/
Also on:    postgresql.org/message-id/BYAPR06MB40235AC790D12757F765CDBFD7080@BYAPR06MB4023.namprd06.prod.outlook.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: crajac66@hotmail.com
  Subject: Re: Is there a way to correct an inaccurate n_distinct value for extended statistics in PG11?
  In-Reply-To: <BYAPR06MB40235AC790D12757F765CDBFD7080@BYAPR06MB4023.namprd06.prod.outlook.com>
  References: <8f314df0-0ee5-452c-8dc6-8627b29acb48@Spark> <BYAPR06MB40235AC790D12757F765CDBFD7080@BYAPR06MB4023.namprd06.prod.outlook.com>

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

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