Thread: Performance question

Performance question

From
"Marcelo de Moraes Serpa"
Date:
Hello list,

If I've got a trigger that calls a function each time there is a DELETE or UPDATE opration on a table in my system, and in this function I retrieve some boolean information from another table and based on this information, additional code will be ran or not in this function. Could the solely fact of calling the function and selecting the data on another table (and the trigger on each update and delete on any table) affect the overall db performance in a noticiable manner ?

Re: Performance question

From
Decibel!
Date:
On Thu, Aug 16, 2007 at 08:52:02AM -0300, Marcelo de Moraes Serpa wrote:
> Hello list,
>
> If I've got a trigger that calls a function each time there is a DELETE or
> UPDATE opration on a table in my system, and in this function I retrieve
> some boolean information from another table and based on this information,
> additional code will be ran or not in this function. Could the solely fact
> of calling the function and selecting the data on another table (and the
> trigger on each update and delete on any table) affect the overall db
> performance in a noticiable manner ?

Of course, you're adding at least one extra query to each UPDATE and
DELETE. Plus the overhead of the trigger itself.

The real question is: so what? If you need that logic to happen, you
need it to happen. Unless you'll be updating or deleting scores of rows
a second, I wouldn't worry too much about it.

Remember the first rule of performance tuning: don't. :)
--
Decibel!, aka Jim Nasby                        decibel@decibel.org
EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)

Attachment