{"id":3447,"date":"2009-08-28T17:59:28","date_gmt":"2009-08-28T15:59:28","guid":{"rendered":"http:\/\/www.glorf.it\/blog\/?p=3447"},"modified":"2009-08-14T21:25:02","modified_gmt":"2009-08-14T19:25:02","slug":"welche-objekte-belegen-wie-viele-datenseiten-im-cache-buffer","status":"publish","type":"post","link":"http:\/\/www.glorf.it\/blog\/2009\/08\/28\/sql-talk\/welche-objekte-belegen-wie-viele-datenseiten-im-cache-buffer","title":{"rendered":"Welche Objekte belegen wie viele Datenseiten im Cache-Buffer?"},"content":{"rendered":"<p>Wenn man im SQL Server 2005 wissen will, was so alles im Datencache steht, dann kann man sich mit Hilfe der Data Management View &quot;sys.dm_os_buffer_descriptors&quot; einen &#220;berblick verschaffen. Man erf&#228;hrt welche Seite in den Cache geladen wurden.<\/p>\n<p>Mit diesem Statement sieht man sogar wie viele Seiten aktuell von welcher Tabelle aus welcher Datenbank im Cache &quot;belegt&quot; werden:<\/p>\n<p><code lang=\"sql\">SELECT\tCASE GROUPING(db.name) WHEN 0 THEN db.name ELSE N'#all dbs#' END\tAS [dbname],<br \/>\n\tCASE GROUPING(object_name(p.object_id)) WHEN 0 THEN object_name(p.object_id) ELSE N&#x0027;#all objects#&#x0027; END\tAS [objname],<br \/>\n\tCASE GROUPING(p.index_id) WHEN 0 THEN CAST(p.index_id AS NVARCHAR) ELSE N&#x0027;#all indexes#&#x0027; END\tAS [indexid],<br \/>\n\tCOUNT(page_id)\t\t\t\tAS [pagecount]<br \/>\n\tFROM sys.dm_os_buffer_descriptors AS bd<br \/>\n\tJOIN sys.allocation_units AS au<br \/>\n\t\tON bd.allocation_unit_id = au.allocation_unit_id<br \/>\n    JOIN sys.partitions p<br \/>\n\t\tON au.container_id = p.hobt_id<br \/>\n\tJOIN sys.databases as db<br \/>\n\t\tON bd.database_id = db.database_id<br \/>\n\tGROUP BY db.name, object_name(p.object_id), p.index_id WITH ROLLUP<br \/>\n\tORDER BY [pagecount] DESC<\/code><\/p>\n<p>Ich hoffe das hilft jemandem&#8230; \ud83d\ude09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Wenn man im SQL Server 2005 wissen will, was so alles im Datencache steht, dann kann man sich mit Hilfe der Data Management View &quot;sys.dm_os_buffer_descriptors&quot; einen &#220;berblick verschaffen. Man erf&#228;hrt welche Seite in den Cache geladen wurden. Mit diesem Statement sieht man sogar wie viele Seiten aktuell von welcher Tabelle aus welcher Datenbank im Cache [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[576,575],"_links":{"self":[{"href":"http:\/\/www.glorf.it\/blog\/wp-json\/wp\/v2\/posts\/3447"}],"collection":[{"href":"http:\/\/www.glorf.it\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.glorf.it\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.glorf.it\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.glorf.it\/blog\/wp-json\/wp\/v2\/comments?post=3447"}],"version-history":[{"count":8,"href":"http:\/\/www.glorf.it\/blog\/wp-json\/wp\/v2\/posts\/3447\/revisions"}],"predecessor-version":[{"id":3468,"href":"http:\/\/www.glorf.it\/blog\/wp-json\/wp\/v2\/posts\/3447\/revisions\/3468"}],"wp:attachment":[{"href":"http:\/\/www.glorf.it\/blog\/wp-json\/wp\/v2\/media?parent=3447"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.glorf.it\/blog\/wp-json\/wp\/v2\/categories?post=3447"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.glorf.it\/blog\/wp-json\/wp\/v2\/tags?post=3447"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}