Re: Guarantees/Semantics of pg_stats

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: "Baziotis, Stefanos" <sb54(at)illinois(dot)edu>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Guarantees/Semantics of pg_stats
Date: 2024-03-02 10:28:37
Message-ID: 5843bce9be8d75bafb203b1a338b417721c5fedc.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Laurenz Albe 2024-03-02 10:32:15 Re: Content for talk on Postgres Type System at PostgresConf
Previous Message Abdul Sayeed 2024-03-02 09:16:21 Re: High Availability and Replication