pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Robert Haas <robertmhaas@gmail.com>
Cc: David Rowley <david.rowley@2ndquadrant.com>
Cc: Simon Riggs <simon@2ndquadrant.com>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Cc: Maksim Milyutin <milyutinma@gmail.com>
Subject: Re: [HACKERS] Proposal: Local indexes for partitioned table
Date: Mon, 18 Dec 2017 13:02:30 -0300
Message-ID: <20171218160230.hdq2k23hheud6arv@alvherre.pgsql> (raw)
In-Reply-To: <CA+TgmobJJwKeBON4H2kb3pnh0-mtJ_MuzOvYCeOgh0w2k_7TCw@mail.gmail.com>

After this discussion, this is how I see things working:

1. pg_dump
   a) creates indexes on partitions normally
   b) once all existing indexes are done, index on parent is created,
      with ONLY.  No cascading occurs, no indexes are attached.
   c) ATTACH is run for each existing partition index.  After each
      ATTACH, we check that all indexes exist.  If so, the parent is
      marked valid.
   d) if not all indexes existed in partitions, index on parent remains
      invalid.  (It was invalid in the dumped database, so this is
      correct.)

2. other uses
   Normal CREATE INDEX (without ONLY) recurses and attaches the first
   matching index it finds (no duplicate indexes are created);
   partitions without a matching index get one created.

3. ALTER INDEX DETACH is not provided.  Therefore: once index is valid,
   it remains so forever.

I think this satisfies all concerns.

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




view thread (142+ messages)  latest in thread

Message-ID: <20171218160230.hdq2k23hheud6arv@alvherre.pgsql>
Permalink:  ../20171218160230.hdq2k23hheud6arv@alvherre.pgsql/
Also on:    postgresql.org/message-id/20171218160230.hdq2k23hheud6arv@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-hackers@postgresql.org
  Cc: alvherre@alvh.no-ip.org, robertmhaas@gmail.com, david.rowley@2ndquadrant.com, simon@2ndquadrant.com, milyutinma@gmail.com
  Subject: Re: [HACKERS] Proposal: Local indexes for partitioned table
  In-Reply-To: <20171218160230.hdq2k23hheud6arv@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