Group: pgsql.patches


Subject: [DOCS] Partition: use triggers instead of rules
From: tgl@sss.pgh.pa.us (Tom Lane)
Date: 11/28/2007 5:17:38 PM
David Fetter <david@fetter.org> writes: > On Wed, Nov 28, 2007 at 03:53:04PM -0500, Tom Lane wrote: >> Entirely removing the example of how to do it with rules doesn't >> seem like a good idea. > It does to me. I haven't found a case yet where rules worked even as > well as triggers. I don't have a problem with emphasizing triggers as the preferred solution, but we should keep the older example, if only because people are going to see DB schemas that use that approach, and they won't understand what's going on (or realize they could convert) if they've not seen an example. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend

Subject: [DOCS] Partition: use triggers instead of rules
From: tgl@sss.pgh.pa.us (Tom Lane)
Date: 11/29/2007 11:17:25 AM
"Joshua D. Drake" <jd@commandprompt.com> writes: > Rules are extremely slow in comparisons and not anywhere near as > flexible. As I said up post yesterday... they work well in the basic > partitioning configuration but anything else they are extremely deficient. I think that the above claim is exceedingly narrow-minded. A trigger will probably beat a rule for inserts/updates involving a small number of rows. For large numbers of rows, like an INSERT/SELECT from another large table, the rule is likely to win, because its overhead is paid once per query not once per row. Also, if you implement the trigger with an EXECUTE (forcing a planning cycle) intead of hard-coded commands, the speed advantage becomes even more dubious. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@postgresql.org so that your message can get through to the mailing list cleanly

Subject: [DOCS] Partition: use triggers instead of rules
From: tgl@sss.pgh.pa.us (Tom Lane)
Date: 11/29/2007 12:12:55 PM
"Joshua D. Drake" <jd@commandprompt.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. Nonsense. Well, maybe *you* never do that, but if so you are hardly reflective of the whole world. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org

Subject: [DOCS] Partition: use triggers instead of rules
From: tgl@sss.pgh.pa.us (Tom Lane)
Date: 12/2/2007 2:21:31 PM
David Fetter <david@fetter.org> writes: > On Fri, Nov 30, 2007 at 12:34:05PM +0530, NikhilS wrote: >> Another reason to go along with triggers is that "COPY" honors >> triggers, but does not honor rules. While trying to do bulk inserts >> into a parent of partitioned tables where rules are being employed, >> the COPY operation will not be so straightforward. > Does my latest patch attached address this well enough? Applied with revisions and extensions. (I take it you hadn't actually tested the example :-() regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend