Is shrinking NDF and MDF files safe? A reader asked if it causes data loss. It does not, but I explain why shrinking them is often not a good idea.
SQL SERVER – 2008 – 2005 – Find Longest Running Query – TSQL – Part 2
An updated script to find the longest running query in SQL Server 2005 and 2008, with the divide by zero error fixed and time now shown in milliseconds.
SQL SERVER – Rules for Optimizining Any Query – Best Practices for Query Optimization
My quick rules for query optimization: a primary key, a clustered index, the right non-clustered indexes, fewer views and triggers, and other simple checks.
SQL SERVER – Difference Between Index Scan and Index Seek
What is the difference between Index Scan and Index Seek? I explain how SQL Server uses search predicates to decide which index operation a query gets.
Index Usage Snapshots: Reject Invalid Counter Deltas
Index usage snapshots require a valid counter window. Keep missing rows and lifecycle gaps visible. The guarded example rejects invalid pairs before calculating any activity delta.
SQL SERVER – sqlcmd – Using a Dedicated Administrator Connection to Kill Currently Running Query
When a long running query makes SQL Server stop responding, sqlcmd with a Dedicated Administrator Connection lets you connect from another computer and kill it.
SQL SERVER – Find Currently Running Query – T-SQL
A short script to find a currently running query on your server using sys.dm_exec_requests, plus the KILL command to stop one that runs for too long.







