SQL SERVER – SET STATISTICS TIME – SET Statement


SET STATISTICS TIME : This set statement is used to get the total time required to parse, compile and execute a SQL statement. The time is represented as milliseconds.

We may not get an accurate result (process time) if we enabled the lightweight pooling option.

The cpu column in the sysprocesses table is only updated when a query executes with SET STATISTICS TIME ON.

Example

pic1when Statistics Time is ON,

pic2SET STATISTICS TIME Usage

SET STATISTICS TIME ON

or

SET STATISTICS TIME OFF

Example

pic3This set statement is another important statement in the SQL query performance tuning.

Leave a comment