pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Make gistvacuumcleanup() count the actual number of index tuples
Date: Fri, 02 Mar 2018 16:22:59 +0000
Message-ID: <E1ernSV-0002g1-BB@gemulon.postgresql.org> (raw)

Make gistvacuumcleanup() count the actual number of index tuples.

Previously, it just returned the heap tuple count, which might be only an
estimate, and would be completely the wrong thing if the index is partial.
Since this function scans every index page anyway to find free pages,
it's practically free to count the surviving index tuples.  Let's do that
and return an accurate count.

This is easily visible as a wrong reltuples value for a partial GiST
index following VACUUM, so back-patch to all supported branches.

Andrey Borodin, reviewed by Michail Nikolaev

Discussion: https://postgr.es/m/151956654251.6915.675951950408204404.pgcf@coridan.postgresql.org

Branch
------
REL9_5_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/46d98da43e56aa407242fc5ca6c0303f160cd936

Modified Files
--------------
src/backend/access/gist/gistvacuum.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)



view thread (6+ messages)  latest in thread

Message-ID: <E1ernSV-0002g1-BB@gemulon.postgresql.org>
Permalink:  ../E1ernSV-0002g1-BB@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1ernSV-0002g1-BB@gemulon.postgresql.org

 · 

reply

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: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Make gistvacuumcleanup() count the actual number of index tuples
  In-Reply-To: <E1ernSV-0002g1-BB@gemulon.postgresql.org>
  References: <E1ernSV-0002g1-BB@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