Browse Guides

Checking your DB Size
Reading mode
Copy Link
Link Copied!
Print
Feedback
This guide has multiple versions available:
<style>p { margin: 0 0 10px; }h1, h2, h3 { margin: 20px 0 10px; }h4, h5, h6 { margin: 10px 0 10px; }</style><p>This guide details how you can check your On-Premise Halo database size.</p>
<style>p { margin: 0 0 10px; }h1, h2, h3 { margin: 20px 0 10px; }h4, h5, h6 { margin: 10px 0 10px; }</style><p>Please run the below query directly on your Halo database:</p> <pre><code class="language-SQL"> SELECT s.name AS SchemaName, t.name AS TableName, SUM(p.rows) AS RowCounts, -- Total space in MB and GB CAST(SUM(a.total_pages) * 8.0 / 1024 AS DECIMAL(10,2)) AS TotalSpaceMB, CAST(SUM(a.total_pages) * 8.0 / (1024 * 1024) AS DECIMAL(10,2)) AS TotalSpaceGB, -- Used space in MB and GB CAST(SUM(a.used_pages) * 8.0 / 1024 AS DECIMAL(10,2)) AS UsedSpaceMB, CAST(SUM(a.used_pages) * 8.0 / (1024 * 1024) AS DECIMAL(10,2)) AS UsedSpaceGB, -- Unused space in MB and GB CAST((SUM(a.total_pages) - SUM(a.used_pages)) * 8.0 / 1024 AS DECIMAL(10,2)) AS UnusedSpaceMB, CAST((SUM(a.total_pages) - SUM(a.used_pages)) * 8.0 / (1024 * 1024) AS DECIMAL(10,2)) AS UnusedSpaceGB FROM sys.tables t INNER JOIN sys.schemas s ON t.schema_id = s.schema_id INNER JOIN sys.partitions p ON t.object_id = p.object_id INNER JOIN sys.allocation_units a ON p.partition_id = a.container_id WHERE t.is_ms_shipped = 0 GROUP BY s.name, t.name ORDER BY TotalSpaceMB DESC; </code></pre>
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.