Network Management

Know each table size in Orion database

This article provides steps on how to know the size for each table in Orion database.

First published date

11/29/2018 10:38 PM

Last published date

4/19/2023 12:08 AM

Overview

This article provides steps on how to find out the size for each table in the Orion database. 

If you have a very large Database SolarWinds recommends you see Quick Orion database health check guide

Product section

Orion Platform

Resolution

Manual Choice 

  1. Go to SQL Management Studio Direct Download Link on Orion SQL server.

    If you have not installed MS SQL, use the link to download and install.

  2. Select New Query. 
  3. Paste the query below. Change the Database name if it's different from the default [NetPerfMon]:
    -- Scripts are not supported under any SolarWinds support program or service.
    -- Scripts are provided AS IS without warranty of any kind. SolarWinds further
    -- disclaims all warranties including, without limitation, any implied warranties
    -- of merchantability or of fitness for a particular purpose. The risk arising
    -- out of the use or performance of the scripts and documentation stays with you.
    -- In no event shall SolarWinds or anyone else involved in the creation,
    -- production, or delivery of the scripts be liable for any damages whatsoever
    -- (including, without limitation, damages for loss of business profits, business
    -- interruption, loss of business information, or other pecuniary loss) arising
    -- out of the use of or inability to use the scripts or documentation.
    
    USE [NetPerfMon]
    GO
    CREATE TABLE #temp (
    table_name sysname ,
    row_count INT,
    reserved_size VARCHAR(50),
    data_size VARCHAR(50),
    index_size VARCHAR(50),
    unused_size VARCHAR(50))
    SET NOCOUNT ON
    INSERT #temp
    EXEC sp_msforeachtable 'sp_spaceused ''?'''
    SELECT a.table_name,
    a.row_count,
    COUNT(*) AS col_count,
    a.data_size
    FROM #temp a
    INNER JOIN information_schema.columns b
    ON a.table_name collate database_default
    = b.table_name collate database_default
    GROUP BY a.table_name, a.row_count, a.data_size
    --ORDER BY CAST(REPLACE(a.data_size, ' KB', '') AS integer) DESC
    ORDER BY a.row_count DESC
    DROP TABLE #temp
     

  4. Click Execute.
  5. At this point, you should be able to see each table with the size and number of rows in each table. 

 

Use SQL Reporting 

  1. Go to SQL Management Studio Direct Download Link on Orion SQL server.

    If you have not installed the SQL Server Management Studio tool, use the link to download and install it.

  2. Right-click your SolarWinds database.
  3. Choose Reports > Standard Reports > Disk Usage by Table.


(Screenshots property of © 2019 Microsoft)