Re: triggers

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Joe Celko (joe.celko_at_northface.edu)
Date: 02/16/04


Date: Mon, 16 Feb 2004 11:43:22 -0800


>> is it ok to code triggers? do they have a very large performance
overhead like cursors do? <<

VERY GENERALLY SPEAKING, Triggers are not as bad as cursors because a
trigger does not leave the database, while a cursor can on either the
database or front end. A cursor in a front end program can be slowed
donw by the host program, too.

Avoid triggers when you can in favor of DRI actions. DRI can pass
implied predicates to the optimizer and a trigger cannot. The T-SQL
syntax does not port or conform to the ANSI/ISO model for triggers.

Think of triggers as by-pass surgery; you don't do it until you have
tried everything else.

--CELKO--
 ===========================
 Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, datatypes, etc. in your
schema are.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Relevant Pages

  • Indirect use of cursors
    ... 9iR1 database has been caused by the recent introduction of some PL/SQL ... The triggers typically fire on insert and/or update, ... but there's zero use of cursors as I understand ...
    (comp.databases.oracle.misc)
  • Re: Triggers, performance, and distributed processing
    ... > Yes, we really like the concept of triggers, and are reluctant to use ... > alternatives to cursors. ... the data is an exact copy of production. ... David G. ...
    (microsoft.public.sqlserver.server)
  • Re: Triggers, performance, and distributed processing
    ... > Yes, we really like the concept of triggers, and are reluctant to use ... > alternatives to cursors. ... the data is an exact copy of production. ... David G. ...
    (microsoft.public.sqlserver.programming)
  • Re: Indirect use of cursors
    ... >The triggers typically fire on insert and/or update, ... >releasing, cursors). ... that recursive sql is also using cursors ...
    (comp.databases.oracle.misc)
  • Re: inserted table and triggers
    ... if the software only updates the fisrt table primary key with the ... Triggers are different from product to product, ... to indivdual rows. ... Your DRI actions touch the second table and *bang*. ...
    (microsoft.public.sqlserver.programming)