This is the query to find the amount of space which each table occupy in there respective Database.
SELECT
DATABASENAME (TITLE ‘Database’)
,TABLENAME (TITLE ‘Table Name’)
,SUM(CURRENTPERM)/(1024*1024*1024) (DECIMAL(15,6)) (TITLE ‘Current Perm Space(GB)’)
FROM DBC.TABLESIZE
WHERE DATABASENAME = ‘YOUR_DATABASE_NAME‘
GROUP BY 1,2
ORDER BY 3 DESC
Where ‘YOUR_DATABASE_NAME‘ is the name of the database for which u need to do the analysis.
This Query will return 3 columns Database, Table Name and Current Perm Space(GB).Based on the analysis of these data we can easily see that how much space each table is occupying in the database.
15 pings
Skip to comment form ↓