Information générale
Forum:
Microsoft SQL Server
Versions des environnements
SQL Server:
SQL Server 2000
>A conversation cam up on which is more expensive to the db a computed column or a trigger.
>
>Example was simple Subtract col 4 from col 3. They were non nullable.
>
>So is a trigger more expensive to run vs. a computed column?
>
>My WAG was the CC.
>
>Any takers with some proof? My googles came up with Oracle and DB2 references :(
>
>__Stephen
Stephen,
It seems to me that the fact that a simple computed column is less expensive than a trigger is self-evident. To run a trigger, SQL Server has to set up a private context for the code, including the INSERTED & DELETED tables. Then the trigger code has to be executed and the environment cleaned up.
There has to be at least 100x more work for the server to run a trigger than to compute a column.
You might want to do a search at sql-server-performance.com to see if there is an article or forum post that can help you to substantiate the claim.
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement