Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 Can we list cached data by key?
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Aged Yak Warrior

596 Posts

Posted - 10/31/2013 :  11:27:46  Show Profile  Reply with Quote
I was wondered if there is a query that we can see which values are in the cache (i.e. buffer pool) by key value?

I know that we can run this:
DBCC IND(DatabaseName, TableName, -1)

Then we can pick a PagePID, and run this:


But I was hoping this could be run in one query to list, to list all values of the Primary Key that are in the cache, showing:

Table, PageID, PKColumn, Value

Is there a query that can do this?

Most Valuable Yak

15732 Posts

Posted - 10/31/2013 :  20:08:10  Show Profile  Visit robvolk's Homepage  Reply with Quote
Interesting problem, but I'm not sure I see what you could do with that information.

It will probably be simpler to query sys.dm_os_buffer_descriptors, that will show you which pages are actually cached. You can then join that to sys.allocation_units and then to sys.partitions to link up to an object_id. Linking those to actual keys is another step I don't know how to do, except to use this:

The main problem is that querying this info will affect the data that's in cache and probably moot whatever you're trying to determine. DBCC PAGE may do the same (according to my tests anyway), as it would buffer its results.
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000