Re: managing table partitions automatically

From: "Obe, Regina" <robe(dot)dnd(at)cityofboston(dot)gov>
To: "Joshua Tolley" <eggyknap(at)gmail(dot)com>, "Ertel, Steve" <Steve(dot)Ertel(at)infimatic(dot)com>
Cc: <pgsql-novice(at)postgresql(dot)org>
Subject: Re: managing table partitions automatically
Date: 2008-11-13 19:19:24
Message-ID: 53F9CF533E1AA14EA1F8C5C08ABC08D204D7F01A@ZDND.DND.boston.cob
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

> 2) Use triggers instead of rules wherever possible
> 3) From the docs: "If more than one trigger is defined for the same
> event on the same relation, the triggers will be fired in alphabetical
> order by trigger name. In the case of before triggers, the
> possibly-modified row returned by each trigger becomes the input to the
> next trigger. If any before trigger returns NULL, the operation is
> abandoned for that row and subsequent triggers are not fired."

> - Josh / eggyknap

Steve,

What you are doing can be implemented with rules or triggers. I wouldn't agree with Josh that in all cases a trigger is better than a rule. It depends on your pattern of inserts and if you are optimizing for speed or manageability or what.

Either way, you will want to put check constraints in each of your tables and have constraint_exclusion = on for your db so you can take advantage of constraint exclusion. And even ask the very fundamental question of if you really have enough data that it makes the most sense to partition right now.

Anyrate Robert Treat's slide is a good primer of how to use both approaches and the pros and cons of each.

http://www.slideshare.net/xzilla/postgresql-partitioning-pgcon-2007-presentation

Just my 2 cents,
Regina

-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Bruce Hyatt 2008-11-14 00:52:52 Re: Upgrade, Install, RPM
Previous Message Joshua Tolley 2008-11-13 17:20:54 Re: managing table partitions automatically