pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-docs@lists.postgresql.org
Subject: Re: Documentation for partitioned indexes?
Date: Fri, 26 Apr 2019 14:53:33 -0400
Message-ID: <20190426185333.GA12464@alvherre.pgsql> (raw)
In-Reply-To: <8756.1556302759@sss.pgh.pa.us>

On 2019-Apr-26, Tom Lane wrote:

> We appear to have a fair amount of support now for operations like
> constructing a partitioned index piecemeal, e.g. adding indexes
> to the partitions one at a time and then attaching them to a
> parent partitioned index, with the parent ultimately transitioning
> from "not valid" to "valid" once all the pieces are attached.
> 
> However, I cannot find any coherent documentation explaining how
> to do this (or why you'd want to).  Am I just looking in the wrong
> places?

Hmm.  Under Notes for CREATE INDEX there is a paragraph on this:

	When CREATE INDEX is invoked on a partitioned table, the default
	behavior is to recurse to all partitions to ensure they all have
	matching indexes. Each partition is first checked to determine
	whether an equivalent index already exists, and if so, that
	index will become attached as a partition index to the index
	being created, which will become its parent index. If no
	matching index exists, a new index will be created and
	automatically attached; the name of the new index in each
	partition will be determined as if no index name had been
	specified in the command. If the ONLY option is specified, no
	recursion is done, and the index is marked invalid. (ALTER INDEX
	... ATTACH PARTITION marks the index valid, once all partitions
	acquire matching indexes.) Note, however, that any partition
	that is created in the future using CREATE TABLE ... PARTITION
	OF will automatically have a matching index, regardless of
	whether ONLY is specified.

I suppose I better add something in Chapter 5 (DDL), possibly inside the
5.10 section (Table Partitioning) -- a new 5.10.6 "Indexes for
Partitioned Tables" perhaps?

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services





view thread (6+ messages)  latest in thread

Message-ID: <20190426185333.GA12464@alvherre.pgsql>
Permalink:  ../20190426185333.GA12464@alvherre.pgsql/
Also on:    postgresql.org/message-id/20190426185333.GA12464@alvherre.pgsql

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: alvherre@2ndquadrant.com, tgl@sss.pgh.pa.us, pgsql-docs@lists.postgresql.org
  Subject: Re: Documentation for partitioned indexes?
  In-Reply-To: <20190426185333.GA12464@alvherre.pgsql>

* 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