Re: Preliminary patch for on-the-fly relpages/reltuples estimation - Mailing list pgsql-patches

From Tom Lane
Subject Re: Preliminary patch for on-the-fly relpages/reltuples estimation
Date
Msg-id 1368.1102346019@sss.pgh.pa.us
Whole thread Raw
In response to Re: Preliminary patch for on-the-fly relpages/reltuples  (Markus Bertheau <twanger@bluetwanger.de>)
List pgsql-patches
Markus Bertheau <twanger@bluetwanger.de> writes:
>> +     num_tuples = ceil(num_tuples + tuples_removed * 0.5);

> Not understanding a thing about the PG source code, and judging from the
> variable names, wouldn't you want ceil(num_tuples + (num_tuples -
> tuples_removed) * 0.5) instead?

No.  num_tuples is post-removal.  The full expression is
    (num_tuples + (num_tuples + tuples_removed)) / 2
which simplifies as above.

            regards, tom lane

pgsql-patches by date:

Previous
From: Markus Bertheau
Date:
Subject: Re: Preliminary patch for on-the-fly relpages/reltuples
Next
From: "Korea PostgreSQL Users' Group"
Date:
Subject: Re: patch contrib/pgcrypto for win32 (2) - bug report