SQL queries execution time

The view sys.dm_exec_query_stats will have statistical information of the cached queries.
The view sys.dm_exec_sql_text will show the actual query executed.

The output will show the results based on the time, the query takes to run,
which you can identify and improve upon.

   txt.text, total_elapsed_time
   sys.dm_exec_query_stats stat
   CROSS APPLY sys.dm_exec_sql_text (stat.sql_handle) txt
   total_elapsed_time desc

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s