Sql-server – SQL Server Estimated I/O Cost in real units

optimizationsql server

As I understand from other StackExchange posts, SQL Servers estimates are unitless meaning an Estimated I/O cost of 2.82387 doesn't refer to the time taken or disk I/O's, but a relative measure of how it compares to other query criteria such as the CPU cost.

enter image description here

Is it possible to get a real estimate of disk I/O's for a query, how many pages it believes it will read in etc.? I'm also interested in the actual costs in these units.

As part of a course I'd like to use methods for calculating estimates (Disk I/O's and result sizes) manually and comparing these to SQL Server results for the same queries.

Is it possible real information on execution plans in SQL server and if so how? Or is it only possible to get this unitless information, which I can't really use for comparison.

Best Answer

The best numbers for IO you can get is to turn on statistics.

SET STATISTICS IO ON

and then run your query via management studio. The set option will work for your current connection, and the information will appear in the messages tab.

Then you'll get information on how many pages will be read based on your query.

Also for ease of parsing complex/large query statistics, I use this handy little webpage: http://www.statisticsparser.com/