Skip site navigation (1) Skip section navigation (2)

Re: Automating PostgreSql table partition using triggers

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: Amitabh Kant <amitabhkant(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Automating PostgreSql table partition using triggers
Date: 2011-01-27 21:27:44
Message-ID: AANLkTi=gPNiY6qpZnye7+0Tz0mo=1DgsPpO8kV2HmogH@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-sql
On Thu, Jan 27, 2011 at 10:50 AM, Amitabh Kant <amitabhkant(at)gmail(dot)com> wrote:
> Hi
>
> I am trying to write a function which is being called from a trigger used
> for partitioning a large table. The partitioning is to happen based on an
> integer field (testing_id). A simplified structure of what I am trying to do
> is written below.

My advice is to move the table creation from a trigger to a nightly
cron job.  I have one that runs each night that checks for the
existence of the needed tables and creates new ones for up to a month
in advance and emails me the results.  that way if it starts failing
I've got 30 days to get things fixed.  Then another script runs that
creates my new triggers to work with the new partitions.

Too many race conditions and performance issues with using dynamic DDL
to create partitions.

In response to

Responses

pgsql-sql by date

Next:From: Amitabh KantDate: 2011-01-28 02:41:09
Subject: Re: Automating PostgreSql table partition using triggers
Previous:From: Viktor BojovićDate: 2011-01-27 21:10:20
Subject: Re: Automating PostgreSql table partition using triggers

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group