Stupid question about triggers

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

 



Hi,

I have found myself in a situation where I need to quickly delete rows
from a production database. Unfortunately table for the rows to be
deleted have triggers which results massive chain of update operations
on other tables. I do not wish those to happen as I'm about to delete
concerned rows from the other tables as well. (7.4.7)

Would

begin work
select reltriggers from pg_class where relname='foo' for update;
update pg_class set reltriggers=0 where relname='foo';
delete from foo where ...
update pg_class set reltriggers=original value where relname='foo';
commit

work?

Or
begin work
select reltriggers from pg_class where relname='foo';
update pg_class set reltriggers=0 where relname='foo';
delete from foo where ...
update pg_class set reltriggers=original value where relname='foo';
commit

as I'm quite sure the number of triggers for that table will not change
while I'm doing the deletion.

Thank you.



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux