I am providing search functionality in my website, when user searches a record then I want to display the time the query taken to get the results same as google does. When w
Please use
-- turn on statistics IO for IO related
SET STATISTICS IO ON
GO
and for time calculation use
SET STATISTICS TIME ON
GO
then It will give result for every query . In messages window near query input window.
You can use
SET STATISTICS TIME { ON | OFF }
Displays the number of milliseconds required to parse, compile, and execute each statement
When SET STATISTICS TIME is ON, the time statistics for a statement are displayed. When OFF, the time statistics are not displayed
USE AdventureWorks2012;
GO
SET STATISTICS TIME ON;
GO
SELECT ProductID, StartDate, EndDate, StandardCost
FROM Production.ProductCostHistory
WHERE StandardCost < 500.00;
GO
SET STATISTICS TIME OFF;
GO