{"id":13913,"date":"2024-03-15T08:08:05","date_gmt":"2024-03-15T08:08:05","guid":{"rendered":"https:\/\/www.silicloud.com\/blog\/how-can-i-check-the-size-of-a-table-space-in-sql-server\/"},"modified":"2025-08-06T01:05:11","modified_gmt":"2025-08-06T01:05:11","slug":"how-can-i-check-the-size-of-a-table-space-in-sql-server","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/blog\/how-can-i-check-the-size-of-a-table-space-in-sql-server\/","title":{"rendered":"Check SQL Server Table Size: Quick Guide"},"content":{"rendered":"<p>In SQL Server, you have a few methods to view the size of table spaces.<\/p>\n<ol>\n<li>You can use the system stored procedure sp_spaceused to retrieve information on the space usage of all tables in the database. Simply execute the following statement in the query window to get the size information of tables.<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code>EXEC sp_spaceused;\r\n<\/code><\/pre>\n<ol>\n<li>You can obtain partition statistical information for all tables and indexes in a database using the system view sys.dm_db_partition_stats. To retrieve information on the size of tables, you can use the following query.<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code>SELECT \r\n    OBJECT_NAME(object_id) AS [TableName],\r\n    SUM(used_page_count) * 8 AS [TableSizeKB]\r\nFROM \r\n    sys.dm_db_partition_stats\r\nWHERE \r\n    index_id IN (0, 1) -- 0 \u662f\u5806\u8868\uff0c1 \u662f\u805a\u96c6\u7d22\u5f15\r\nGROUP BY \r\n    object_id\r\nORDER BY \r\n    [TableSizeKB] DESC;\r\n<\/code><\/pre>\n<p>This query will return the name of each table and its size in kilobytes.<\/p>\n<ol>\n<li>You can get information about the size of table spaces using the system view sys.allocation_units, which provides details about all allocation units in the database, including those for tables, indexes, and heaps.<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code>SELECT \r\n    OBJECT_NAME(object_id) AS [TableName],\r\n    SUM(total_pages) * 8 AS [TableSizeKB]\r\nFROM \r\n    sys.allocation_units\r\nWHERE \r\n    type IN (1, 3) -- 1 \u662f IN_ROW_DATA \u7528\u4e8e\u8868\u548c\u7d22\u5f15\uff0c3 \u662f LOB_DATA \u7528\u4e8e\u5927\u578b\u5bf9\u8c61\uff08\u4f8b\u5982\uff1a\u6587\u672c\u548c\u56fe\u50cf\uff09\r\nGROUP BY \r\n    object_id\r\nORDER BY \r\n    [TableSizeKB] DESC;\r\n<\/code><\/pre>\n<p>This query will retrieve the name of each table and the space it occupies, measured in kilobytes.<\/p>\n<p>Please note that the space size returned by the above method is an approximation and may differ from the space size reported at the operating system level. This is because SQL Server uses pages to manage data, which incurs some additional overhead during page allocation and deallocation.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In SQL Server, you have a few methods to view the size of table spaces. You can use the system stored procedure sp_spaceused to retrieve information on the space usage of all tables in the database. Simply execute the following statement in the query window to get the size information of tables. EXEC sp_spaceused; You [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","footnotes":""},"categories":[1],"tags":[513,4088,7974,572,3116],"class_list":["post-13913","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-database-management","tag-sp_spaceused","tag-space-usage","tag-sql-server","tag-table-size"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Check SQL Server Table Size: Quick Guide - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"Learn quick methods to check SQL Server table size using sp_spaceused and sys.dm_db_partition_stats. Optimize your database space management now.\" \/>\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.silicloud.com\/blog\/how-can-i-check-the-size-of-a-table-space-in-sql-server\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Check SQL Server Table Size: Quick Guide\" \/>\n<meta property=\"og:description\" content=\"Learn quick methods to check SQL Server table size using sp_spaceused and sys.dm_db_partition_stats. Optimize your database space management now.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/blog\/how-can-i-check-the-size-of-a-table-space-in-sql-server\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/SiliCloudGlobal\/\" \/>\n<meta property=\"article:published_time\" content=\"2024-03-15T08:08:05+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-06T01:05:11+00:00\" \/>\n<meta name=\"author\" content=\"William Carter\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@SiliCloudGlobal\" \/>\n<meta name=\"twitter:site\" content=\"@SiliCloudGlobal\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"William Carter\" \/>\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\":\"Article\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/how-can-i-check-the-size-of-a-table-space-in-sql-server\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/how-can-i-check-the-size-of-a-table-space-in-sql-server\/\"},\"author\":{\"name\":\"William Carter\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/f697031891aacefc4b681d139781d3c0\"},\"headline\":\"Check SQL Server Table Size: Quick Guide\",\"datePublished\":\"2024-03-15T08:08:05+00:00\",\"dateModified\":\"2025-08-06T01:05:11+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/how-can-i-check-the-size-of-a-table-space-in-sql-server\/\"},\"wordCount\":209,\"publisher\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/#organization\"},\"keywords\":[\"Database Management\",\"sp_spaceused\",\"Space usage\",\"sql server\",\"table size\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/how-can-i-check-the-size-of-a-table-space-in-sql-server\/\",\"url\":\"https:\/\/www.silicloud.com\/blog\/how-can-i-check-the-size-of-a-table-space-in-sql-server\/\",\"name\":\"Check SQL Server Table Size: Quick Guide - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/#website\"},\"datePublished\":\"2024-03-15T08:08:05+00:00\",\"dateModified\":\"2025-08-06T01:05:11+00:00\",\"description\":\"Learn quick methods to check SQL Server table size using sp_spaceused and sys.dm_db_partition_stats. Optimize your database space management now.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/how-can-i-check-the-size-of-a-table-space-in-sql-server\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/blog\/how-can-i-check-the-size-of-a-table-space-in-sql-server\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/how-can-i-check-the-size-of-a-table-space-in-sql-server\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.silicloud.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Check SQL Server Table Size: Quick Guide\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/blog\/\",\"name\":\"Silicon Cloud Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/#organization\"},\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#organization\",\"name\":\"Silicon Cloud Blog\",\"url\":\"https:\/\/www.silicloud.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.silicloud.com\/blog\/wp-content\/uploads\/2023\/11\/EN-SILICON-Full.png\",\"contentUrl\":\"https:\/\/www.silicloud.com\/blog\/wp-content\/uploads\/2023\/11\/EN-SILICON-Full.png\",\"width\":1024,\"height\":1024,\"caption\":\"Silicon Cloud Blog\"},\"image\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/SiliCloudGlobal\/\",\"https:\/\/twitter.com\/SiliCloudGlobal\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/f697031891aacefc4b681d139781d3c0\",\"name\":\"William Carter\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/1786698071dd8d74bec894b512f9e3c610c3a2a32985f67e688976cee3c8bbef?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/1786698071dd8d74bec894b512f9e3c610c3a2a32985f67e688976cee3c8bbef?s=96&d=mm&r=g\",\"caption\":\"William Carter\"},\"url\":\"https:\/\/www.silicloud.com\/blog\/author\/williamcarter\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Check SQL Server Table Size: Quick Guide - Blog - Silicon Cloud","description":"Learn quick methods to check SQL Server table size using sp_spaceused and sys.dm_db_partition_stats. Optimize your database space management now.","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.silicloud.com\/blog\/how-can-i-check-the-size-of-a-table-space-in-sql-server\/","og_locale":"en_US","og_type":"article","og_title":"Check SQL Server Table Size: Quick Guide","og_description":"Learn quick methods to check SQL Server table size using sp_spaceused and sys.dm_db_partition_stats. Optimize your database space management now.","og_url":"https:\/\/www.silicloud.com\/blog\/how-can-i-check-the-size-of-a-table-space-in-sql-server\/","og_site_name":"Blog - Silicon Cloud","article_publisher":"https:\/\/www.facebook.com\/SiliCloudGlobal\/","article_published_time":"2024-03-15T08:08:05+00:00","article_modified_time":"2025-08-06T01:05:11+00:00","author":"William Carter","twitter_card":"summary_large_image","twitter_creator":"@SiliCloudGlobal","twitter_site":"@SiliCloudGlobal","twitter_misc":{"Written by":"William Carter","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.silicloud.com\/blog\/how-can-i-check-the-size-of-a-table-space-in-sql-server\/#article","isPartOf":{"@id":"https:\/\/www.silicloud.com\/blog\/how-can-i-check-the-size-of-a-table-space-in-sql-server\/"},"author":{"name":"William Carter","@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/f697031891aacefc4b681d139781d3c0"},"headline":"Check SQL Server Table Size: Quick Guide","datePublished":"2024-03-15T08:08:05+00:00","dateModified":"2025-08-06T01:05:11+00:00","mainEntityOfPage":{"@id":"https:\/\/www.silicloud.com\/blog\/how-can-i-check-the-size-of-a-table-space-in-sql-server\/"},"wordCount":209,"publisher":{"@id":"https:\/\/www.silicloud.com\/blog\/#organization"},"keywords":["Database Management","sp_spaceused","Space usage","sql server","table size"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/blog\/how-can-i-check-the-size-of-a-table-space-in-sql-server\/","url":"https:\/\/www.silicloud.com\/blog\/how-can-i-check-the-size-of-a-table-space-in-sql-server\/","name":"Check SQL Server Table Size: Quick Guide - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/blog\/#website"},"datePublished":"2024-03-15T08:08:05+00:00","dateModified":"2025-08-06T01:05:11+00:00","description":"Learn quick methods to check SQL Server table size using sp_spaceused and sys.dm_db_partition_stats. Optimize your database space management now.","breadcrumb":{"@id":"https:\/\/www.silicloud.com\/blog\/how-can-i-check-the-size-of-a-table-space-in-sql-server\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/blog\/how-can-i-check-the-size-of-a-table-space-in-sql-server\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/blog\/how-can-i-check-the-size-of-a-table-space-in-sql-server\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.silicloud.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Check SQL Server Table Size: Quick Guide"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/blog\/#website","url":"https:\/\/www.silicloud.com\/blog\/","name":"Silicon Cloud Blog","description":"","publisher":{"@id":"https:\/\/www.silicloud.com\/blog\/#organization"},"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.silicloud.com\/blog\/#organization","name":"Silicon Cloud Blog","url":"https:\/\/www.silicloud.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.silicloud.com\/blog\/wp-content\/uploads\/2023\/11\/EN-SILICON-Full.png","contentUrl":"https:\/\/www.silicloud.com\/blog\/wp-content\/uploads\/2023\/11\/EN-SILICON-Full.png","width":1024,"height":1024,"caption":"Silicon Cloud Blog"},"image":{"@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/SiliCloudGlobal\/","https:\/\/twitter.com\/SiliCloudGlobal"]},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/f697031891aacefc4b681d139781d3c0","name":"William Carter","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/1786698071dd8d74bec894b512f9e3c610c3a2a32985f67e688976cee3c8bbef?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1786698071dd8d74bec894b512f9e3c610c3a2a32985f67e688976cee3c8bbef?s=96&d=mm&r=g","caption":"William Carter"},"url":"https:\/\/www.silicloud.com\/blog\/author\/williamcarter\/"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/posts\/13913","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/comments?post=13913"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/posts\/13913\/revisions"}],"predecessor-version":[{"id":157922,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/posts\/13913\/revisions\/157922"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/media?parent=13913"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/categories?post=13913"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/tags?post=13913"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}