Triggers and transactions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If I drop and then recreate a trigger inside of a single transaction, how does it affect other processes trying to use the same table?  Can they just merrily go along their way using the table, or will they be blocked by an exclusive lock?

We have a trigger that detects illegal drugs and dangerous chemicals (such as explosives and flammable compounds that can't be shipped by air).  It's implemented as a trigger to ensure that even improperly coded application software can't accidentally let a customer order a prohibited compound.

Unfortunately, the trigger's function is necessarily "heavyweight" and slow.

The drop-and-restore-trigger operation is needed when we're copying data one server to another.  Since the data on the primary source have already been checked, there's no need to let the trigger re-check every row.  When I drop-and-recreate the trigger for the duration of a COPY operation, it speeds the operation from (for example) 30 minutes to 15 seconds.

But if the drop-and-restore-trigger operation blocks all access to the tables, that's a problem.

Thanks,
Craig


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux