Best practice question - Mailing list pgsql-performance

From Tory M Blue
Subject Best practice question
Date
Msg-id CAEaSS0YL4CvdgJ0sTLhRx1EQAKpJi1+KTC9FvyGMsPS=TJ3zMg@mail.gmail.com
Whole thread Raw
Responses Re: Best practice question  (David G Johnston <david.g.johnston@gmail.com>)
Re: Best practice question  (Sergey Konoplev <gray.ru@gmail.com>)
List pgsql-performance
Hi
I am going to add a new column to a table for modify_date that needs to be updated every time the table is updated. Is it better to just update application code to set the modify_date to current_time, or create a Before-Update trigger on the table that will update the modify_date column to current_timestamp when the table is updated? I also have slony in place, so the trigger will need to be on master and slave. Slony will take care of suppressing it on the slave and enabling in the event of a switchover, but it is additional overhead and validation to make sure nothing failed on switchover.

So considering that we have slony, is it better to use application code to update the modify_date or use a trigger? Is a trigger essentially 2 updates to the table? Are there any other risks in using the trigger?

Thanks

Tory Blue

pgsql-performance by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: Fast distinct not working as expected
Next
From: David G Johnston
Date:
Subject: Re: Best practice question