Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7418713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:56:08+00:00 2026-05-29T07:56:08+00:00

I have a single SQL Server table with 10 different triggers that fire on

  • 0

I have a single SQL Server table with 10 different triggers that fire on the same INSERT and UPDATE.

Is there any performance advantage to consolidating the SQL inside the 10 triggers into a single trigger?

The single consolidated trigger would do the same thing as the 10 different triggers, but only one trigger would get fired instead of 10.

Thanks!

Update: Thanks for the great feedback. I updated my question to indicate that I am wondering about performance advantages. I didn’t think of the “absolute control over order” advantage. I am aware that these various triggers should be refactored at some point, but am wondering more about performance of one versus many triggers.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T07:56:08+00:00Added an answer on May 29, 2026 at 7:56 am

    Consolidating triggers can make a huge performance boost. For example consider the following table, two triggers, and an update:

    CREATE TABLE dbo.TriggerTest(ID INT NOT NULL PRIMARY KEY,
    s INT NOT NULL)
    GO
    INSERT INTO dbo.TriggerTest(ID, s)
    SELECT n, 1 FROM dbo.Numbers
    WHERE n BETWEEN 1 AND 100000;
    GO
    
    CREATE TRIGGER TriggerTestNoSignChange
    ON dbo.TriggerTest
    AFTER UPDATE
    AS
    BEGIN
        IF EXISTS(SELECT * FROM INSERTED AS i JOIN DELETED AS d
        ON i.id = d.id WHERE sign(i.s)*sign(d.s)<0)
        BEGIN
            RAISERROR('s cannot change sign', 16, 1);
            ROLLBACK ;
        END
    END
    GO
    
    CREATE TRIGGER TriggerTestNoBigChange
    ON dbo.TriggerTest
    AFTER UPDATE
    AS
    BEGIN
        IF EXISTS(SELECT * FROM INSERTED AS i JOIN DELETED AS d
        ON i.id = d.id WHERE ABS(i.s - d.s)>5)
        BEGIN
            RAISERROR('s cannot change by more than 5', 16, 1);
            ROLLBACK ;
        END
    END
    GO
    
    
    UPDATE dbo.TriggerTest SET s=s+1
    WHERE ID BETWEEN 1 AND 1000;
    

    This update uses 1671 ms CPU and 4M reads. Let’s consolidate two triggers and rerun the update:

    DROP TRIGGER TriggerTestNoSignChange;
    DROP TRIGGER TriggerTestNoBigChange;
    GO
    CREATE TRIGGER TriggerTestNoBigChangeOrSignChange
    ON dbo.TriggerTest
    AFTER UPDATE
    AS
    BEGIN
        IF EXISTS(SELECT * FROM INSERTED AS i JOIN DELETED AS d
        ON i.id = d.id WHERE sign(i.s)*sign(d.s)<0 OR ABS(i.s - d.s)>5)
        BEGIN
            RAISERROR('s cannot change sign or change by more than 5', 16, 1);
            ROLLBACK ;
        END
    END
    GO
    
    
    UPDATE dbo.TriggerTest SET s=s+1
    WHERE ID BETWEEN 1 AND 1000;
    

    The same update runs twice us fast. Big surprise. 😉

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a SQL Server table full of orders that my program needs to
I have a table in SQL Server 2000 that I am trying to query
We have a Single Statement FUNCTION in SQL Server 2005 which uses CONTAINSTABLE(). All
Can you have a single SQL that order events by current day then future
I have my project in .NET that uses a database in SQL Server. I'm
I have an Sql Server Table.. it's something like this: Id ...... Column1 ......
I'm experiencing something a bit strange. I have a table on SQL Server 2008,
I'm writing an application that will have a SQL Server backend that will store
I have an SSIS package that exports data from a table on a SQL
You can return a single table from a T-SQL Function in SQL Server 2008.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.