pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Peter Geoghegan <pg@bowt.ie>
Cc: David Rowley <david.rowley@2ndquadrant.com>
Cc: Alex V. <in_flight@pclovers.ru>
Cc: pgsql-general <pgsql-general@lists.postgresql.org>
Cc: tgl <tgl@sss.pgh.pa.us>
Subject: Re: Table partition with primary key in 11.3
Date: Fri, 7 Jun 2019 15:43:32 -0400
Message-ID: <20190607194332.GA23667@alvherre.pgsql> (raw)
In-Reply-To: <CAH2-Wz=FxBOeR489a_6z3700cborQc=h8tQmZOmyp0G=jgdqgg@mail.gmail.com>

On 2019-Jun-07, Peter Geoghegan wrote:

> On Fri, Jun 7, 2019 at 12:18 PM Alvaro Herrera <alvherre@2ndquadrant.com> wrote:
> > I was thinking of asynchonously cleaning it up rather than blocking
> > DROP/DETACH ... which means you need to keep state somewhere.  I don't
> > think blocking DROP/DETACH is valuable -- a global index that blocks
> > DROP/DETACH until the index is clean serves no useful purpose.  (You
> > could think of a multi-step approach with internal transaction commits,
> > similar to CIC, but you still need a plan to clean that up in case the
> > server crashes during that operation.)
> 
> The advantage of synchronous clean-up of global indexes when DROP'ing
> a partition are that you can recycle the partition number (or whatever
> we end up calling it) immediately and predictably, and you can reuse
> the space in indexes occupied by keys from the dropped partition
> immediately and predictably. That seems less useful than asynchronous
> processing on average, certainly, but those are still real advantages.
> You seemed to be particularly concerned about quickly recycling
> partition numbers when we drop a partition.

Well, "quickly" might mean within a week.  If it takes that long to
fully remove a monthly partition to make that partition ID available to
some future month's partition, that seems acceptable.  Blocking
DROP/DETACH for one hour is certainly not acceptable.

If this scheme means that you can keep the partition identifiers stored
in the index to, for instance, 10 bits (allowing for 1024 partitions to
exist at any one time, including those in the process of being cleaned
up) instead of having to expand to (say) 24 because that covers a couple
of years of operation before having to recreate the index, it seems
worthwhile.

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





view thread (19+ messages)  latest in thread

Message-ID: <20190607194332.GA23667@alvherre.pgsql>
Permalink:  ../20190607194332.GA23667@alvherre.pgsql/
Also on:    postgresql.org/message-id/20190607194332.GA23667@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 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-general@postgresql.org
  Cc: alvherre@2ndquadrant.com, pg@bowt.ie, david.rowley@2ndquadrant.com, in_flight@pclovers.ru, tgl@sss.pgh.pa.us
  Subject: Re: Table partition with primary key in 11.3
  In-Reply-To: <20190607194332.GA23667@alvherre.pgsql>
  References: <CAH2-Wz=FxBOeR489a_6z3700cborQc=h8tQmZOmyp0G=jgdqgg@mail.gmail.com> <20190607194332.GA23667@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