Re: table partitioning

From: Gene <genekhart(at)gmail(dot)com>
To: Chris <dmagick(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: table partitioning
Date: 2006-08-23 04:10:56
Message-ID: 430d92a20608222110qbd1ebl8914ac9ad62b0bf2@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Chris,

I'm using a cron job which creates a new partition table every night at
midnight. After I create the table, I update the rule on the parent table so
that new records go into the new partition table. Then I update the
constraints on the tables so that constraint exclusion works. I'm doing it
this way because you'll find if you have multiple rules on the parent table
it might not return the proper result for the number of affected rows (might
not be an issue for you). If you don't need to do it like this, just create
a script that creates all the tables ahead of time. for year-month shouldn't
be too many.

Gene

On 8/22/06, Chris <dmagick(at)gmail(dot)com> wrote:
>
> Hi all,
>
> I'm checking out table partitioning and wondering how to handle it
> dynamically.
>
> For example, if I want to partition by year & month, do I need to create
> all of the partitions (& rules) before hand or can I handle all of that
> another way (a pl/pgsql function? something else?)
>
> Any pointers would be most handy, thanks!
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
>

--
Eugene Hart

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2006-08-23 05:12:14 Re: unique constraint when updating tables
Previous Message surabhi.ahuja 2006-08-23 04:06:18 org.postgresql.util.PSQLException: An I/O error occured while sending to the backend