pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@postgresql.org
Subject: pgsql: Expand hash indexes more gradually.
Date: Tue, 04 Apr 2017 03:46:40 +0000
Message-ID: <E1cvFQW-0002Yc-H2@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Expand hash indexes more gradually.

Since hash indexes typically have very few overflow pages, adding a
new splitpoint essentially doubles the on-disk size of the index,
which can lead to large and abrupt increases in disk usage (and
perhaps long delays on occasion).  To mitigate this problem to some
degree, divide larger splitpoints into four equal phases.  This means
that, for example, instead of growing from 4GB to 8GB all at once, a
hash index will now grow from 4GB to 5GB to 6GB to 7GB to 8GB, which
is perhaps still not as smooth as we'd like but certainly an
improvement.

This changes the on-disk format of the metapage, so bump HASH_VERSION
from 2 to 3.  This will force a REINDEX of all existing hash indexes,
but that's probably a good idea anyway.  First, hash indexes from
pre-10 versions of PostgreSQL could easily be corrupted, and we don't
want to confuse corruption carried over from an older release with any
corruption caused despite the new write-ahead logging in v10.  Second,
it will let us remove some backward-compatibility code added by commit
293e24e507838733aba4748b514536af2d39d7f2.

Mithun Cy, reviewed by Amit Kapila, Jesper Pedersen and me.  Regression
test outputs updated by me.

Discussion: http://postgr.es/m/CAD__OuhG6F1gQLCgMQNnMNgoCvOLQZz9zKYJQNYvYmmJoM42gA@mail.gmail.com
Discussion: http://postgr.es/m/CA+TgmoYty0jCf-pa+m+vYUJ716+AxM7nv_syvyanyf5O-L_i2A@mail.gmail.com

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/ea69a0dead5128c421140dc53fac165ba4af8520

Modified Files
--------------
contrib/pageinspect/expected/hash.out        |  4 +-
contrib/pgstattuple/expected/pgstattuple.out |  4 +-
doc/src/sgml/pageinspect.sgml                |  6 +--
src/backend/access/hash/README               | 62 ++++++++++++++++----------
src/backend/access/hash/hashovfl.c           |  9 ++--
src/backend/access/hash/hashpage.c           | 62 +++++++++++++-------------
src/backend/access/hash/hashsort.c           | 27 +++++++++---
src/backend/access/hash/hashutil.c           | 65 ++++++++++++++++++++++++++++
src/backend/utils/sort/tuplesort.c           | 37 +++++++++++-----
src/include/access/hash.h                    | 24 ++++++++--
src/include/utils/tuplesort.h                |  4 +-
11 files changed, 218 insertions(+), 86 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


Message-ID: <E1cvFQW-0002Yc-H2@gemulon.postgresql.org>
Permalink:  ../E1cvFQW-0002Yc-H2@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1cvFQW-0002Yc-H2@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: rhaas@postgresql.org
  Subject: Re: pgsql: Expand hash indexes more gradually.
  In-Reply-To: <E1cvFQW-0002Yc-H2@gemulon.postgresql.org>
  References: <E1cvFQW-0002Yc-H2@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