Asynchronous Triggers in SQL Server 2005/2008

后端 未结 10 1047
-上瘾入骨i
-上瘾入骨i 2020-12-08 09:51

I have triggers that manipulate and insert a lot of data into a Change tracking table for audit purposes on every insert, update and delete.

This t

10条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-08 10:19

    Create history table(s). While updating (/deleting/inserting) main table, insert old values of record (deleted pseudo-table in trigger) into history table; some additional info is needed too (timestamp, operation type, maybe user context). New values are kept in live table anyway.

    This way triggers run fast(er) and you can shift slow operations to log viewer (procedure).

提交回复
热议问题