Friday, April 14, 2023

MS-SQL Server - Truncate, Delete & TAT

Truncate, Delete & TAT

 

- Truncate, some people have confusion about this command, This is a pure DML but in few other database technology this may be DDL. In SQL Server all DMLs can be rolledback, considering a fact that we have initiated BEGIN Tran or Query Analyser configured accordingly.


- DELETE is also DML but Slower than Truncate, another important thing is we cannot reclaim space just by DELETE as we need to ensure running Index Rebuild after DELETE to get benefit out of it.


Additionally,


DROP TABLE cannot be used to drop a table that is referenced by a FOREIGN KEY constraint.


https://learn.microsoft.com/en-us/sql/t-sql/statements/drop-table-transact-sql?view=sql-server-ver16


TAT (Turn Around Time) can be analysed by the T-SQL Script from msdb job history table and this can be provided as on email request.


Layout

https://learn.microsoft.com/en-us/sql/ssms/tutorials/ssms-configuration?view=sql-server-ver16



Best Regards



T. Amit Vaid S.

No comments: