Measure SQL performance without using a profiler

Are there easier ways to measure SQL performance in MS-SQL than using a profiler?

I use this script that I found on the Internet and it gives me measurements, but I do not know how accurate it can be.

DECLARE @StartTime datetime;

DBCC DROPCLEANBUFFERS  -- Force data/index pages out of buffer cache for valid test
SET @StartTime = GETDATE() -- Measurement Starts  

-->Insert SQL CALL/Script here

-- Measurement Ends  
SELECT ExecutionTimeInMS = DATEDIFF(millisecond, @StartTime, getdate())
GO

Are there any similar alternatives to get a quick and dirty, generally accurate boost to the choices I make?

It returned some unexpected results, but shouldn't I direct surprise to test requests or a test tool / script?

+4
source share
2 answers

Here is my test setup:

DBCC DROPCLEANBUFFERS
DBCC freeproccache

SET STATISTICS IO ON
SET STATISTICS TIME ON

SELECT * FROM sys.all_columns

( ):

(4307 row(s) affected)
Table 'syscolrdb'. Scan count 1, logical reads 167, physical reads 0, read-ahead reads 167, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Table 'syscolpars'. Scan count 1, logical reads 12, physical reads 1, read-ahead reads 10, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

SQL Server Execution Times:
   CPU time = 78 ms,  elapsed time = 738 ms.
+2

checkpoint, . , . SQL- , , , , .

"" . , . , , , .

, , , , - . , , , , .

, , find: ) (, ) b) .

, -, . .

0

Source: https://habr.com/ru/post/1544789/


All Articles