| From: | Melanie Plageman <melanieplageman(at)gmail(dot)com> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: pgsql: Fix pgstattuple_approx handling of unknown tuple estimates |
| Date: | 2026-11-18 18:18:49 |
| Message-ID: | CAAKRu_bvcmBSUreBH2VkN8KS6MhBJbAaJfROO32QHL=Oj9t3Rg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
On Wed, Nov 18, 2026 at 10:43 AM Melanie Plageman
<melanieplageman(at)gmail(dot)com> wrote:
>
> Fix pgstattuple_approx handling of unknown tuple estimates
>
> vac_estimate_reltuples() can return -1 when there is not enough
> information to estimate the number of live tuples. pgstattuple_approx()
> assigned that value to an unsigned counter before attempting to clamp
> it, making the clamp ineffective and exposing -1 through the bigint
> result.
>
> Clamp the signed estimate before assigning it to the unsigned counter.
Looks like I broke the buildfarm with the new test
# @@ -257,11 +257,7 @@
# commit;
# select scanned_percent, approx_tuple_count
# from pgstattuple_approx('test_approx_unknown');
# - scanned_percent | approx_tuple_count
# ------------------+--------------------
# - 0 | 0
# -(1 row)
# -
# +ERROR: cannot access temporary tables during a parallel operation
# -- not for the index calls though, of course
# select pgstatindex('test_partition');
# ERROR: relation "test_partition" is not a btree index
# 1 of 1 tests failed.
Something about debug_parallel_query setting that didn't fail locally.
I will investigate and push a fix.
- Melanie
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Masahiko Sawada | 2026-11-18 18:30:29 | pgsql: Fall back to serializing when parallel apply runs out of DSM seg |
| Previous Message | Tom Lane | 2026-11-18 17:45:44 | pgsql: Fix formatting of to_char's EEEE output for numeric and bigint. |