pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mark Stosberg <mark@summersault.com>
To: pgsql-admin@postgresql.org
Subject: Re: best practice for moving millions of rows to child table when setting up partitioning?
Date: Wed, 04 May 2011 12:48:44 -0400
Message-ID: <ips01d$351$1@dough.gmane.org> (raw)
In-Reply-To: <659395.83416.qm@web39708.mail.mud.yahoo.com>
References: <ip9abr$nk8$1@dough.gmane.org>
	<659395.83416.qm@web39708.mail.mud.yahoo.com>


>> 5. Finally, I'll drop the indexes on the parent table and
>> truncate it.

Luckily I noticed the problem with TRUNCATE and partitioning before my
work got to production.

TRUNCATE cascades automatically and silently to child tables, which was
not my intent.

This is mentioned here:
http://wiki.postgresql.org/wiki/Table_partitioning

But is not mentioned in the official documentation for TRUNCATE:

http://www.postgresql.org/docs/9.0/static/sql-truncate.html

The work-around we used was to put the TRUNCATE statement ahead of the
ALTER TABLE .. INHERIT statements in our final transaction.

   Mark





view thread (15+ messages)  latest in thread

Message-ID: <ips01d$351$1@dough.gmane.org>
Permalink:  ../ips01d$351$1@dough.gmane.org/
Also on:    postgresql.org/message-id/ips01d$351$1@dough.gmane.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 using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: mark@summersault.com
  Subject: Re: best practice for moving millions of rows to child table when setting up partitioning?
  In-Reply-To: <ips01d$351$1@dough.gmane.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