pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Teodor Sigaev <teodor@sigaev.ru>
To: Amit Kapila <amit.kapila16@gmail.com>
To: AP <pgsql@inml.weebeastie.net>
To: PostgreSQL Bugs <pgsql-bugs@postgresql.org>
Subject: Re: 10.1: hash index size exploding on vacuum full analyze
Date: Fri, 15 Dec 2017 17:38:50 +0300
Message-ID: <d465e05a-6022-354c-e001-181c61c6b090@sigaev.ru> (raw)
In-Reply-To: <CAA4eK1+6BSGrm+NtUDhx59CNR51Ehbnmch9LpswMEyrLBBjKLg@mail.gmail.com>
References: <20171115232922.5tomkxnw3iq6jsg7@inml.weebeastie.net>
	<CAA4eK1LirO6XD2go8vDOG7scqbNCr_D=oEFtaCTGzpnHdgZEKQ@mail.gmail.com>
	<20171119233157.y5zqrn6ccvzxfw4w@inml.weebeastie.net>
	<CAA4eK1+PYgxOKr-wJiOF37BWFdPjH6O-OyNN1V+58T=gtyY6tg@mail.gmail.com>
	<CAA4eK1+6BSGrm+NtUDhx59CNR51Ehbnmch9LpswMEyrLBBjKLg@mail.gmail.com>

Hi!

> I think if we update the stats in copy_heap_data after copying the
> data, then we don't see such problem.  Attached patch should fix the
> issue.  You can try this patch to see if it fixes the issue for you.
I'm afraid I'm not able to reproduce the problem which patch should fix.

What I did (today's master, without patch):
autovacuum off
pgbench -i -s 100

select relname, relpages, reltuples from pg_class where relname = 
'pgbench_accounts';
      relname      | relpages | reltuples
------------------+----------+-----------
  pgbench_accounts |   163935 |     1e+07

vacuum full pgbench_accounts;

# select relname, relpages, reltuples from pg_class where relname = 
'pgbench_accounts';
      relname      | relpages | reltuples
------------------+----------+-----------
  pgbench_accounts |   163935 |     1e+07


I've tried to add hash index to that table and print notice about number of 
pages and tuples immediately after estimate_rel_size() in hashbuild(). hash 
index got right estimation even I deleted all rows before vacuum full. What am I 
doing wrong?

Patch looks good except, seems, updating stats is better to move to 
swap_relation_files(), then it will work even for  toast tables.


-- 
Teodor Sigaev                                   E-mail: teodor@sigaev.ru
                                                    WWW: http://www.sigaev.ru/




view thread (32+ messages)  latest in thread

Message-ID: <d465e05a-6022-354c-e001-181c61c6b090@sigaev.ru>
Permalink:  ../d465e05a-6022-354c-e001-181c61c6b090@sigaev.ru/
Also on:    postgresql.org/message-id/d465e05a-6022-354c-e001-181c61c6b090@sigaev.ru

 · 

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-bugs@postgresql.org
  Cc: teodor@sigaev.ru, amit.kapila16@gmail.com, pgsql@inml.weebeastie.net
  Subject: Re: 10.1: hash index size exploding on vacuum full analyze
  In-Reply-To: <d465e05a-6022-354c-e001-181c61c6b090@sigaev.ru>
  References: <20171115232922.5tomkxnw3iq6jsg7@inml.weebeastie.net> <CAA4eK1LirO6XD2go8vDOG7scqbNCr_D=oEFtaCTGzpnHdgZEKQ@mail.gmail.com> <20171119233157.y5zqrn6ccvzxfw4w@inml.weebeastie.net> <CAA4eK1+PYgxOKr-wJiOF37BWFdPjH6O-OyNN1V+58T=gtyY6tg@mail.gmail.com> <CAA4eK1+6BSGrm+NtUDhx59CNR51Ehbnmch9LpswMEyrLBBjKLg@mail.gmail.com> <d465e05a-6022-354c-e001-181c61c6b090@sigaev.ru>

* 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