Discussion Locked

Statistical SQL Statement

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I'm looking for a SQL statement that returns statistical information on reading a database (i.e. reads to disk, reads to page, etc.).

I greatly appreciate any assistance.

Thank you!

5 replies

by tink

It would help if you specify which database.

In Microsoft SQL Server 2000 you can use any of the following commands:

EXECUTE sp_monitor
This will provide a report containing statistics about Microsoft SQL Server including packets received, packets sent, packet errors, total read, total write, total errors.

SELECT @@CONNECTIONS
will return the number of connections since the server was last started.

SELECT @@TOTAL_READ
will return the number of disk reads since the server was laststarted.

SELECT @@TOTAL_WRITE
will return the number of disk writes since the server was last started.

by salexru2000

Easiest way is to check MSDN for statistics (Stat is the key) and t-sql. You will a lot. E.g. for disk statistics you can use SET STATISTICS IO before your statement(s). Then you'll get display of stats until SET STATISTICS OFF. Works in 7.0 and higher.
Hope this helps.

This discussion is closed to new replies.