In SQL Server, is there some magic SQL I can preprend my SQL query to get an estimated query cost rather than the query executed?
Possibly something like the below is my best guess myself.. seems very verbose though
SET STATISTICS PROFILE ON
GO
SELECT * FROM [Account]
GO
SET STATISTICS PROFILE OFF
STATISTICS PROFILEgives you the actual plan, which means that the query will get executed.SHOWPLAN_XMLorSHOWPLAN_ALL(text plan) will give you the estimated plan without executing the query. You can click on the xml result to see the graphical plan. If that does not work use SQL Sentry Plan Explorer (free) to show the plan.