From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Baziotis, Stefanos <sb54@illinois.edu>
To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Guarantees/Semantics of pg_stats
Date: Sat, 02 Mar 2024 11:28:37 +0100
Message-ID: <5843bce9be8d75bafb203b1a338b417721c5fedc.camel@cybertec.at> (raw)
In-Reply-To: <PH8PR11MB8061725CB9BACBED45D76F77AB5D2@PH8PR11MB8061.namprd11.prod.outlook.com>
References: <PH8PR11MB8061725CB9BACBED45D76F77AB5D2@PH8PR11MB8061.namprd11.prod.outlook.com>
On Sat, 2024-03-02 at 07:41 +0000, Baziotis, Stefanos wrote:
> I'm interested in learning more about the guarantees/semantics of pg_stats.
> For example, is there a guarantee that the n_distinct and most_common_vals
> fields will take into account any values appearing more than M times or
> maybe with frequence more than f? In what cases will n_distinct and
> most_common_vals will miss some values?
Table Statistics are not exact. They are collected from a random sample of
the data, so they are never guaranteed to be exact.
Their purpose is to estimate the result row count and cost of execution plan
steps. You can never use them as proof.
Yours,
Laurenz Albe
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-general@postgresql.org
Cc: laurenz.albe@cybertec.at, sb54@illinois.edu
Subject: Re: Guarantees/Semantics of pg_stats
In-Reply-To: <5843bce9be8d75bafb203b1a338b417721c5fedc.camel@cybertec.at>
References: <PH8PR11MB8061725CB9BACBED45D76F77AB5D2@PH8PR11MB8061.namprd11.prod.outlook.com> <5843bce9be8d75bafb203b1a338b417721c5fedc.camel@cybertec.at>
* 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