pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: pgsql-committers@postgresql.org
Subject: pgsql: BRIN auto-summarization
Date: Sat, 01 Apr 2017 17:02:58 +0000
Message-ID: <E1cuMQU-0002zT-Ke@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

BRIN auto-summarization

Previously, only VACUUM would cause a page range to get initially
summarized by BRIN indexes, which for some use cases takes too much time
since the inserts occur.  To avoid the delay, have brininsert request a
summarization run for the previous range as soon as the first tuple is
inserted into the first page of the next range.  Autovacuum is in charge
of processing these requests, after doing all the regular vacuuming/
analyzing work on tables.

This doesn't impose any new tasks on autovacuum, because autovacuum was
already in charge of doing summarizations.  The only actual effect is to
change the timing, i.e. that it occurs earlier.  For this reason, we
don't go any great lengths to record these requests very robustly; if
they are lost because of a server crash or restart, they will happen at
a later time anyway.

Most of the new code here is in autovacuum, which can now be told about
"work items" to process.  This can be used for other things such as GIN
pending list cleaning, perhaps visibility map bit setting, both of which
are currently invoked during vacuum, but do not really depend on vacuum
taking place.

The requests are at the page range level, a granularity for which we did
not have SQL-level access; we only had index-level summarization
requests via brin_summarize_new_values().  It seems reasonable to add
SQL-level access to range-level summarization too, so add a function
brin_summarize_range() to do that.

Authors: Álvaro Herrera, based on sketch from Simon Riggs.
Reviewed-by: Thomas Munro.
Discussion: https://postgr.es/m/20170301045823.vneqdqkmsd4as4ds@alvherre.pgsql

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/7526e10224f0792201e99631567bbe44492bbde4

Modified Files
--------------
doc/src/sgml/brin.sgml                 |   9 +-
doc/src/sgml/func.sgml                 |  10 +-
doc/src/sgml/ref/create_index.sgml     |  12 +-
src/backend/access/brin/brin.c         | 124 ++++++++--
src/backend/access/brin/brin_revmap.c  |   6 +-
src/backend/access/common/reloptions.c |   9 +
src/backend/postmaster/autovacuum.c    | 430 ++++++++++++++++++++++++++++++++-
src/include/access/brin.h              |   5 +
src/include/catalog/catversion.h       |   2 +-
src/include/catalog/pg_proc.h          |   2 +
src/include/postmaster/autovacuum.h    |  12 +
src/test/regress/expected/brin.out     |  48 ++++
src/test/regress/sql/brin.sql          |  28 +++
13 files changed, 672 insertions(+), 25 deletions(-)


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


view thread (2+ messages)  latest in thread

Message-ID: <E1cuMQU-0002zT-Ke@gemulon.postgresql.org>
Permalink:  ../E1cuMQU-0002zT-Ke@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1cuMQU-0002zT-Ke@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: alvherre@alvh.no-ip.org
  Subject: Re: pgsql: BRIN auto-summarization
  In-Reply-To: <E1cuMQU-0002zT-Ke@gemulon.postgresql.org>
  References: <E1cuMQU-0002zT-Ke@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