From: ktm@rice.edu
To: Mark Stosberg <mark@summersault.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Re: best practice for moving millions of rows to child table when setting up partitioning?
Date: Wed, 04 May 2011 19:04:51 -0500
Message-ID: <20110504190451.1123213u1k1v878j@webmail.rice.edu> (raw)
In-Reply-To: <ips01d$351$1@dough.gmane.org>
References: <ip9abr$nk8$1@dough.gmane.org>
<659395.83416.qm@web39708.mail.mud.yahoo.com>
<ips01d$351$1@dough.gmane.org>
Quoting Mark Stosberg <mark@summersault.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
You need to use the "ONLY" option to TRUNCATE to just do the single
parent and not cascade to the child tables.
Regards,
Ken
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-admin@postgresql.org
Cc: ktm@rice.edu, mark@summersault.com
Subject: Re: best practice for moving millions of rows to child table when setting up partitioning?
In-Reply-To: <20110504190451.1123213u1k1v878j@webmail.rice.edu>
References: <ip9abr$nk8$1@dough.gmane.org> <659395.83416.qm@web39708.mail.mud.yahoo.com> <ips01d$351$1@dough.gmane.org> <20110504190451.1123213u1k1v878j@webmail.rice.edu>
* 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