Created
June 13, 2012 12:45
-
-
Save Mpdreamz/2923851 to your computer and use it in GitHub Desktop.
Profile MSSQL - clear cache and time a query
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dbcc freeproccache | |
go | |
dbcc dropcleanbuffers | |
go | |
DECLARE @a DATETIME, @b DATETIME | |
SET @a = CURRENT_TIMESTAMP | |
-- QUERY BIT | |
select * from | |
(select Row_Number() over (order by Id) as RowIndex | |
,* | |
FROM SomeTable) as Sub | |
Where Sub.RowIndex >= 1000 and Sub.RowIndex < 2000 | |
-- END QUERY BIT | |
SET @b = CURRENT_TIMESTAMP | |
SELECT DATEDIFF(MS, @a, @b) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment