Re: Partitioning an existing table

From: Phoenix Kiula <phoenix(dot)kiula(at)gmail(dot)com>
To: Greg Smith <greg(at)2ndquadrant(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Partitioning an existing table
Date: 2011-04-28 04:12:34
Message-ID: BANLkTinYZROgu3ZM-t0KTpEgbuJkhFd+6w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Apr 26, 2011 at 8:28 PM, Greg Smith <greg(at)2ndquadrant(dot)com> wrote:
> On 04/25/2011 10:10 AM, Vick Khera wrote:
>>
>> Basically, you create your partitions and set up the necessary triggers
>> you want (I re-write the app to insert directly into the correct partition).
>>  Then all new data starts going into the partitions.  Next, write a program
>> that loops over the current master table, and moves the data into each
>> partition some small hunk at a time, in a transaction.  This can take a long
>> time.  For us, it took about 7 days to move O(100m) rows.  Then, when you're
>> done, truncate the master table, and enforce that no new data is allowed to
>> be inserted into it.
>
> Vick's presentation at
> http://cdn.mailermailer.com/documents/PGCon2008TablePartitioningCaseStudy.pdf

Thanks everyone for the excellent suggestions.

Vick/Greg, thanks in particular for this reference. The doc gives me
ideas for other things too!

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2011-04-28 04:34:20 Re: Best way to construct PostgreSQL ArrayType (_int4) from C int array
Previous Message David Cifuentes 2011-04-28 00:37:15 Re: [ANNOUNCE] [HACKERS] PostgreSQL Core Team