Self Abort Transaction

We always faces challenges that a transaction is blocked for hours. In SQL Server 2014 Microsoft introduced MAX_DURATION and ABORT_AFTER_WAIT=SELF. Which means  that the session will kill itself if any locks are not released inside MAX_DURATION

ALTER INDEX idx_Col1 ON Foo REBUILD
WITH
(ONLINE = ON
(WAIT_AT_LOW_PRIORITY
(MAX_DURATION = 1,ABORT_AFTER_WAIT = SELF)
)
)
GO

Leave a Reply

Your email address will not be published. Required fields are marked *