Performance Issues with triggers

  • I have writting an after trigger for insert for a table. When a record is getting inserted it is executing and updating the value. But when 20 records are inserted at a time then it is taking approx 8 min of time to update.

    Do I need to use Instead of trigger?

    My problem is whenever a record is about to insert it should be updated and then inserted into the table.

    Thanks is advance

    Naveen

  • If each time that a record is inserted into the table, you run an update statement on the new record, then I agree with you that you should use an instead of trigger. As for your code’s performance – If you won’t add the tables’ definition and the trigger’s code, there is no way that anyone will be able to help you find out why the trigger is very slow.

    Adi

    --------------------------------------------------------------
    To know how to ask questions and increase the chances of getting asnwers:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • It would help if you provided the DDL for the table and the trigger, as well as some sample data with expected results. You can get some help with this by reading the first article regarding asking for assistance that I reference below in my signature block. A bonus by taking the time to do this is that you will get tested code in return.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply