Subject | Re: [firebird-support] Disabling triggers |
---|---|
Author | Martijn Tonies |
Post date | 2005-04-22T06:26:26Z |
Hello Adam,
With regards,
Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server
Upscene Productions
http://www.upscene.com
> We are doing some testing at the moment with a fair chunk of data. WeWhat's wrong with ALTER TRIGGER <name> INACTIVE;
> need to empty a table containing lots of records. To make it even
> worse, there are 4 or 5 other tables that reference that table by a
> foreign key (on delete cascade), and nearly all of them have deletion
> triggers that will in turn update other tables. So:
>
> delete from MyTable;
>
> works but takes the better part of 10 minutes because of the domino
> effect.
>
> I would like to temporarily disable the triggers on this table (which
> is what is making it take so long).
>
> Looking through the system tables, it looks like the following code
> should turn off all the triggers, but leave in place the check
> constraints and foreign keys etc.
>
> update RDB$TRIGGERS
> set RDB$TRIGGER_INACTIVE=1
> where RDB$TRIGGER_SOURCE is not null;
>
> Is there any danger in doing this? (apart from database consistency if
> the triggers do not run) This is only to help speed up testing, not
> including it in a release.
With regards,
Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server
Upscene Productions
http://www.upscene.com