Re: Partition: use triggers instead of rules

From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Gregory Stark <stark(at)enterprisedb(dot)com>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Michael Paesold" <mpaesold(at)gmx(dot)at>, "NikhilS" <nikkhils(at)gmail(dot)com>, "David Fetter" <david(at)fetter(dot)org>, "Jonah H(dot) Harris" <jonah(dot)harris(at)gmail(dot)com>, "PostgreSQL Docs" <pgsql-docs(at)postgresql(dot)org>, "PostgreSQL Patches" <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Partition: use triggers instead of rules
Date: 2007-11-29 17:13:59
Message-ID: 20071129091359.206fd8f2@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-patches

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, 29 Nov 2007 17:08:29 +0000
Gregory Stark <stark(at)enterprisedb(dot)com> wrote:

>
> "Joshua D. Drake" <jd(at)commandprompt(dot)com> writes:
>
> > Tom Lane wrote:
> >
> >> A trigger will probably beat a rule for inserts/updates involving
> >> a small number of rows.
> >
> > Which is exactly what partitioning is doing.
>
> Say what?

Heh, o.k. that was an ambiguous sentence. In a partitioned environment
you are likely not moving millions of rows around. Thus the "rule"
benefit is lost. You are instead performing many (sometimes
lots-o-many) inserts and updates that involve a small number of rows.

A trigger/function as Tom already pointed out is going to perform better
than a rule in that case. The benefit becomes even more pronounce the
more partitions you have.

Sincerely,

Joshua D. Drake

- --

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 24x7/Emergency: +1.800.492.2240
PostgreSQL solutions since 1997 http://www.commandprompt.com/
UNIQUE NOT NULL
Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
PostgreSQL Replication: http://www.commandprompt.com/products/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFHTvNXATb/zqfZUUQRAqeJAJ9CoO6F4zYJwY4geAR1UsvVCYqagwCdFJm9
63GRksppATp7fK9qu2RYXD0=
=VuWy
-----END PGP SIGNATURE-----

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Andrew Dunstan 2007-11-29 17:19:42 Re: [PATCHES] Partition: use triggers instead of rules
Previous Message Tom Lane 2007-11-29 17:12:55 Re: [PATCHES] Partition: use triggers instead of rules

Browse pgsql-patches by date

  From Date Subject
Next Message Andrew Dunstan 2007-11-29 17:19:42 Re: [PATCHES] Partition: use triggers instead of rules
Previous Message Tom Lane 2007-11-29 17:12:55 Re: [PATCHES] Partition: use triggers instead of rules