August 20, 2008 at 11:24 am
Is there a way to know in SQL Server the most hits on table with using SQL Profiler. Is this statistics already store in the system tables.
I need to know which tables have most hits in sql server.
Thanks
August 20, 2008 at 11:38 am
You could use sys.dm_db_index_usage_stats to tell. You would have to do some aggregation of columns and rows, but it looks like it would work.
This is probably better than trying to get this from Profiler.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
August 20, 2008 at 11:54 am
Thanks for your reply but this does not work on SQL 2000. Sorry, I did not mentioned ver.
Is there a similar command on sql 2000 server.
August 20, 2008 at 12:02 pm
Not that I am aware of.
BTW-if your question pertains to SQL Server 2000 you should have posted it in a SQL Server 2000 forum.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
August 20, 2008 at 12:03 pm
aww too bad your on 2000; I found Jack's suggestion really interesting and slapped this together real quick and it gave me promising results:
[font="Courier New"]
SELECT
DB_NAME(database_id) AS dbname,
OBJECT_NAME(OBJECT_ID,database_id) AS tablename,
SUM(user_seeks) AS userseeks,
SUM(user_scans) AS userseeks,
SUM(user_lookups) AS userseeks,
SUM(user_updates) AS userseeks
FROM sys.dm_db_index_usage_stats
WHERE database_id > 4
AND LEFT(OBJECT_NAME(OBJECT_ID,database_id),3) <> 'sys'
GROUP BY DB_NAME(database_id),OBJECT_NAME(OBJECT_ID,database_id)[/font]
Lowell
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply