From: Melanie Plageman <melanieplageman@gmail.com>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Return NULL for unknown pgstattuple estimate
Date: Thu, 19 Nov 2026 16:36:04 +0000
Message-ID: <E1xU57D-00000000PGY-0xib@gemulon.postgresql.org> (raw)
Return NULL for unknown pgstattuple estimate
pgstattuple_approx() returns 0 when there is not enough information to
estimate the number of live tuples, making an unknown estimate
indistinguishable from an estimate of an empty table.
Return NULL for approx_tuple_count instead
Suggested-by: Lukas Fittl <lukas@fittl.com>
Discussion: https://postgr.es/m/CAP53PkzhhC4yQtmBLGHz41-Bs3ZqtQdtYGjxMh_xcTK6Z7eU9Q%40mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/b443bc7406fd92f1f869cc700810ef9a17a01d82
Modified Files
--------------
contrib/pgstattuple/expected/pgstattuple.out | 4 ++--
contrib/pgstattuple/pgstatapprox.c | 10 +++++++---
contrib/pgstattuple/sql/pgstattuple.sql | 2 +-
doc/src/sgml/pgstattuple.sgml | 5 +++--
4 files changed, 13 insertions(+), 8 deletions(-)
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-committers@postgresql.org
Cc: melanieplageman@gmail.com
Subject: Re: pgsql: Return NULL for unknown pgstattuple estimate
In-Reply-To: <E1xU57D-00000000PGY-0xib@gemulon.postgresql.org>
References: <E1xU57D-00000000PGY-0xib@gemulon.postgresql.org>
* 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