{"id":4118,"date":"2013-05-01T12:37:16","date_gmt":"2013-05-01T19:37:16","guid":{"rendered":"http:\/\/3.209.169.194\/blogs\/paul\/?p=4118"},"modified":"2013-06-18T02:11:49","modified_gmt":"2013-06-18T09:11:49","slug":"survey-data-files-and-filegroups-per-database-code-to-run","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/paul\/survey-data-files-and-filegroups-per-database-code-to-run\/","title":{"rendered":"Survey: data files and filegroups per database (code to run)"},"content":{"rendered":"<p><strong>This survey is closed &#8211; please don&#8217;t spend your time sending any more data &#8211; thanks<\/strong><\/p>\n<p>In this survey I&#8217;d like to see what the distribution of the number of data files and filegroups per database is for your servers.<\/p>\n<p>Please run the following code (with example output):<\/p>\n<pre class=\"brush: sql; title: ; toolbar: true; wrap-lines: true; notranslate\" title=\"\">\r\nSELECT\r\n    COUNT (*) AS &#x5B;DataFiles],\r\n    COUNT (DISTINCT data_space_id) AS &#x5B;Filegroups],\r\n    SUM (size) AS &#x5B;Size]\r\nFROM sys.master_files\r\nWHERE &#x5B;type_desc] = N'ROWS' -- filter out log files\/data_space_id 0\r\n    AND &#x5B;database_id] &gt; 4  -- filter out system databases\r\n    AND &#x5B;FILE_ID] != 65537 -- filter out FILESTREAM\r\nGROUP BY &#x5B;database_id];\r\nGO\r\n<\/pre>\n<pre class=\"brush: plain; gutter: false; title: ; toolbar: true; wrap-lines: true; notranslate\" title=\"\">\r\nDataFiles   Filegroups  Size\r\n----------- ----------- -----------\r\n1           1           288\r\n1           1           288\r\n3           2           25600\r\n<\/pre>\n<p>And send me the results for as many servers as you want. You can either <a href=\"mailto:paul@sqlskills.com?subject=Data Files Survey\">email<\/a> me plaintext or a spreadsheet or append the results as a comment to this post. Please do not add any more info to the results (like server name, version etc.) as it&#8217;s not relevant for this survey and adds a bunch of time to the results processing.<\/p>\n<p>Note that the script will only work on 2005 onward.<\/p>\n<p>I&#8217;ll editorialize the results in a week or two.<\/p>\n<p>Thanks!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This survey is closed &#8211; please don&#8217;t spend your time sending any more data &#8211; thanks In this survey I&#8217;d like to see what the distribution of the number of data files and filegroups per database is for your servers. Please run the following code (with example output): SELECT COUNT (*) AS &#x5B;DataFiles], COUNT (DISTINCT [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[91],"tags":[],"class_list":["post-4118","post","type-post","status-publish","format-standard","hentry","category-surveys"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Survey: data files and filegroups per database (code to run) - Paul S. Randal<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.sqlskills.com\/blogs\/paul\/survey-data-files-and-filegroups-per-database-code-to-run\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Survey: data files and filegroups per database (code to run) - Paul S. Randal\" \/>\n<meta property=\"og:description\" content=\"This survey is closed &#8211; please don&#8217;t spend your time sending any more data &#8211; thanks In this survey I&#8217;d like to see what the distribution of the number of data files and filegroups per database is for your servers. Please run the following code (with example output): SELECT COUNT (*) AS &#x5B;DataFiles], COUNT (DISTINCT [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/paul\/survey-data-files-and-filegroups-per-database-code-to-run\/\" \/>\n<meta property=\"og:site_name\" content=\"Paul S. Randal\" \/>\n<meta property=\"article:published_time\" content=\"2013-05-01T19:37:16+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2013-06-18T09:11:49+00:00\" \/>\n<meta name=\"author\" content=\"Paul Randal\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Paul Randal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/survey-data-files-and-filegroups-per-database-code-to-run\/\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/survey-data-files-and-filegroups-per-database-code-to-run\/\",\"name\":\"Survey: data files and filegroups per database (code to run) - Paul S. Randal\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#website\"},\"datePublished\":\"2013-05-01T19:37:16+00:00\",\"dateModified\":\"2013-06-18T09:11:49+00:00\",\"author\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/survey-data-files-and-filegroups-per-database-code-to-run\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlskills.com\/blogs\/paul\/survey-data-files-and-filegroups-per-database-code-to-run\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/survey-data-files-and-filegroups-per-database-code-to-run\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Survey: data files and filegroups per database (code to run)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#website\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/\",\"name\":\"Paul S. Randal\",\"description\":\"In Recovery...\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce\",\"name\":\"Paul Randal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g\",\"caption\":\"Paul Randal\"},\"sameAs\":[\"http:\/\/3.209.169.194\/blogs\/paul\"],\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/author\/paul\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Survey: data files and filegroups per database (code to run) - Paul S. Randal","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.sqlskills.com\/blogs\/paul\/survey-data-files-and-filegroups-per-database-code-to-run\/","og_locale":"en_US","og_type":"article","og_title":"Survey: data files and filegroups per database (code to run) - Paul S. Randal","og_description":"This survey is closed &#8211; please don&#8217;t spend your time sending any more data &#8211; thanks In this survey I&#8217;d like to see what the distribution of the number of data files and filegroups per database is for your servers. Please run the following code (with example output): SELECT COUNT (*) AS &#x5B;DataFiles], COUNT (DISTINCT [&hellip;]","og_url":"https:\/\/www.sqlskills.com\/blogs\/paul\/survey-data-files-and-filegroups-per-database-code-to-run\/","og_site_name":"Paul S. Randal","article_published_time":"2013-05-01T19:37:16+00:00","article_modified_time":"2013-06-18T09:11:49+00:00","author":"Paul Randal","twitter_misc":{"Written by":"Paul Randal","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/survey-data-files-and-filegroups-per-database-code-to-run\/","url":"https:\/\/www.sqlskills.com\/blogs\/paul\/survey-data-files-and-filegroups-per-database-code-to-run\/","name":"Survey: data files and filegroups per database (code to run) - Paul S. Randal","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#website"},"datePublished":"2013-05-01T19:37:16+00:00","dateModified":"2013-06-18T09:11:49+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce"},"breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/survey-data-files-and-filegroups-per-database-code-to-run\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/paul\/survey-data-files-and-filegroups-per-database-code-to-run\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/survey-data-files-and-filegroups-per-database-code-to-run\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/paul\/"},{"@type":"ListItem","position":2,"name":"Survey: data files and filegroups per database (code to run)"}]},{"@type":"WebSite","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#website","url":"https:\/\/www.sqlskills.com\/blogs\/paul\/","name":"Paul S. Randal","description":"In Recovery...","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sqlskills.com\/blogs\/paul\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce","name":"Paul Randal","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g","caption":"Paul Randal"},"sameAs":["http:\/\/3.209.169.194\/blogs\/paul"],"url":"https:\/\/www.sqlskills.com\/blogs\/paul\/author\/paul\/"}]}},"_links":{"self":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts\/4118","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/comments?post=4118"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts\/4118\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/media?parent=4118"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/categories?post=4118"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/tags?post=4118"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}