This is a discussion on Partition: use triggers instead of rules within the Pgsql Patches forums, part of the PostgreSQL category; --> Folks, Best practices for partitioning so far have shown that TRIGGERs are better than RULEs for most cases. Please ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Folks, Best practices for partitioning so far have shown that TRIGGERs are better than RULEs for most cases. Please find attached a patch which reflects this. Thanks to Robert Treat for help putting this together Cheers, David. -- David Fetter <david@fetter.org> http://fetter.org/ Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter Skype: davidfetter XMPP: david.fetter@gmail.com Remember to vote! Consider donating to Postgres: http://www.postgresql.org/about/donate ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings |
| |||
| On Wed, Nov 28, 2007 at 12:39:04PM -0800, Joshua D. Drake wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On Wed, 28 Nov 2007 12:26:15 -0800 > David Fetter <david@fetter.org> wrote: > > > Folks, > > > > Best practices for partitioning so far have shown that TRIGGERs are > > better than RULEs for most cases. Please find attached a patch which > > reflects this. > > > > Thanks to Robert Treat for help putting this together > > > > Cheers, > > David. > > +1 > > Joshua D. Drake Per Robert, I've also dropped the UNION partitioning suggestion as it's pretty useless. Cheers, David. -- David Fetter <david@fetter.org> http://fetter.org/ Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter Skype: davidfetter XMPP: david.fetter@gmail.com Remember to vote! Consider donating to Postgres: http://www.postgresql.org/about/donate ---------------------------(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 |
| |||
| 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 |
| |||
| On Wed, Nov 28, 2007 at 05:17:38PM -0500, Tom Lane wrote: > 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. Greg Sabino Mullane managed to contrive an example where RULEs might conceivably be the least-bad way to do this, that being a machine where no PLs may be installed. Telling people how to do this is not *quite* as bad as describing how to do EAV, but it's pretty close. Cheers, David. -- David Fetter <david@fetter.org> http://fetter.org/ Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter Skype: davidfetter XMPP: david.fetter@gmail.com Remember to vote! Consider donating to Postgres: http://www.postgresql.org/about/donate ---------------------------(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 |
| |||
| David Fetter wrote: > Greg Sabino Mullane managed to contrive an example where RULEs might > conceivably be the least-bad way to do this, that being a machine > where no PLs may be installed. Perhaps this just means we should consider installing plpgsql by default. -- Alvaro Herrera http://www.amazon.com/gp/registry/5ZYLFMCVHXC "There was no reply" (Kernel Traffic) ---------------------------(end of broadcast)--------------------------- TIP 7: You can help support the PostgreSQL project by donating at http://www.postgresql.org/about/donate |
| |||
| On Nov 28, 2007 3:53 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote: > Entirely removing the example of how to do it with rules doesn't > seem like a good idea. Agreed. -- Jonah H. Harris, Sr. Software Architect | phone: 732.331.1324 EnterpriseDB Corporation | fax: 732.331.1301 499 Thornall Street, 2nd Floor | jonah.harris@enterprisedb.com Edison, NJ 08837 | http://www.enterprisedb.com/ ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings |
| |||
| On Wed, Nov 28, 2007 at 09:58:26PM -0500, Jonah H. Harris wrote: > On Nov 28, 2007 3:53 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote: > > Entirely removing the example of how to do it with rules doesn't > > seem like a good idea. > > Agreed. Do you have an example of one use case where using RULEs rather than TRIGGERs is a good idea? Cheers, David. -- David Fetter <david@fetter.org> http://fetter.org/ Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter Skype: davidfetter XMPP: david.fetter@gmail.com Remember to vote! Consider donating to Postgres: http://www.postgresql.org/about/donate ---------------------------(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 |
| |||
| On Wed, 28 Nov 2007, Alvaro Herrera wrote: > David Fetter wrote: > > > Greg Sabino Mullane managed to contrive an example where RULEs might > > conceivably be the least-bad way to do this, that being a machine > > where no PLs may be installed. > > Perhaps this just means we should consider installing plpgsql by > default. I have run into this myself, and a patch that I contributed (which made it in to 8.3) made it possible for a database owner to create trusted languages from templates in the default configuration. Which means that if an admin wants to prevent usage of the language, they can revoke the right to create it, but db owners still "opt-in" to any languages they want. ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster |
| |||
| On Thu, Nov 29, 2007 at 12:55:53AM -0500, Tom Lane wrote: > David Fetter <david@fetter.org> writes: > > On Wed, Nov 28, 2007 at 09:58:26PM -0500, Jonah H. Harris wrote: > >> On Nov 28, 2007 3:53 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote: > >>> Entirely removing the example of how to do it with rules doesn't > >>> seem like a good idea. > >> > >> Agreed. > > > Do you have an example of one use case where using RULEs rather > > than TRIGGERs is a good idea? > > The argument I made for keeping the example around is not dependent > on the assumption that using a rule is a good idea. It's dependent > on the established fact that we have recommended that in prior > releases, and therefore people are going to be seeing that construct > in real databases. We've corrected mistakes in the manual before Cheers, David. -- David Fetter <david@fetter.org> http://fetter.org/ Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter Skype: davidfetter XMPP: david.fetter@gmail.com Remember to vote! Consider donating to Postgres: http://www.postgresql.org/about/donate ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match |
| ||||
| > > > The argument I made for keeping the example around is not dependent on > > the assumption that using a rule is a good idea. It's dependent on > > the established fact that we have recommended that in prior releases, > > and therefore people are going to be seeing that construct in real > > databases. > > And they could refer back to the older version of the documentation for > it. In fact, we should mention that in the patch: > > <note><para>If you have a partitioning setup that uses rules please > refer to the 8.2 documentation on partitioning</para></note> > +1 Regards, Nikhils -- EnterpriseDB http://www.enterprisedb.com |