Is there any way to see how many queries are executed in like every hour, or per database / hour, or average number of queries on a day, or ...whatever is interesting?
Just for statistics.. I like numbers. I can't just start a trace with Sql Server Profiler, because the UI will crash when too many queries come by.
Does SQL keep track of some basic 'executed queries statistics' somewhere, or are there any tools I can use to get this information?
(I use SQL Server 2008 R2)
In SQL, you can make a database query and use the COUNT function to get the number of rows for a particular group in the table. Here is the basic syntax: SELECT COUNT(column_name) FROM table_name; COUNT(column_name) will not include NULL values as part of the count.
Using Client StatisticsGo to Menu >> Query >> Select Include client Statistics. Execute your query. In the results panel, you can see a new tab Client Statistics. Go to the Client Statistics tab to see the execution time.
The COUNT() function returns the number of records returned by a select query. Note: NULL values are not counted.
This should work:
select *
from sys.dm_os_performance_counters
where counter_name = 'Batch Requests/sec'
It actually returns the total Batch Requests. You poll this number periodically and then use this calculation:
ReqsPerSec = (curr.Value - prev.Value) / (curr.time - prev.time)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With