Wednesday, October 15, 2003

Ever wondered what is in your SQL Server's cache and how many times a cached item is used?
Check out the master..syscacheobjects table.

If you want to work with the database name just join the table with the sysdatabases.dbid field.


SELECT, master..syscacheobjects.objtype,
master..syscacheobjects.cacheobjtype, master..syscacheobjects.usecounts,
master..syscacheobjects.[sql] FROM master..syscacheobjects
INNER JOIN master..sysdatabases ON master..syscacheobjects.dbid = master..sysdatabases.dbid
WHERE = 'yourdbname'
GROUP BY master..syscacheobjects.objtype,, master..syscacheobjects.cacheobjtype, master..syscacheobjects.status, master..syscacheobjects.[sql], master..syscacheobjects.usecounts
ORDER BY master..syscacheobjects.usecounts DESC

No comments: