Re: Re: best practice for moving millions of rows to child table when setting up partitioning?

From: ktm(at)rice(dot)edu
To: Mark Stosberg <mark(at)summersault(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Re: best practice for moving millions of rows to child table when setting up partitioning?
Date: 2011-05-05 00:04:51
Message-ID: 20110504190451.1123213u1k1v878j@webmail.rice.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Quoting Mark Stosberg <mark(at)summersault(dot)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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message adrien ducos 2011-05-05 10:02:16 Re: My server is oddly very slow
Previous Message Sam Stearns 2011-05-04 22:53:16 Re: Unable to Insert Row