Disk Space

Database

Disk Space

I have an empty table, But if we check its space occupied from the dbc.diskspace table it shows some 15 GB as the current perm, though in dbc.tablesize the diskspace is 0.2 MB. Does anybody know how these tables work. Ideally there should not be any difference. Kindly refer to the query attached below:-

SELECT
a.TableName
,a.cp (TITLE 'TableCurrentPerm')
,c.dcp (TITLE 'DBCurrentPerm')
,c.mp (TITLE 'DBMaxPerm')
,CAST((c.mp)/1048576 AS DECIMAL(8,2)) (TITLE 'TotalDbSpace (Mb)')
,CAST((a.cp)/1048576 AS DECIMAL(8,2)) (TITLE 'TableSpace (Mb)')
,CAST(a.cp*100/c.mp AS DECIMAL(8,2)) (TITLE '%UsedSpace')
,CAST((c.mp-a.cp)/1048576 AS DECIMAL(8,2)) (TITLE 'FreeSpace (Mb)')
,CAST((c.mp-a.cp)*100/c.mp AS DECIMAL(8,2)) (TITLE '%FreeSpace')

FROM
(
SELECT
DataBaseName
,TableName
,SUM(currentperm) (NAMED cp)
FROM Dbc.TableSize
GROUP BY 1,2
) a

INNER JOIN
(
SELECT DataBaseName
,SUM(currentperm) (NAMED dcp)
,(CASE WHEN SUM(maxperm) = 0 THEN 1 ELSE SUM(maxperm) END) (NAMED mp)
FROM dbc.diskspace
GROUP BY 1
) c

ON a.DataBaseName = c.DataBaseName
WHERE c.DataBaseName = ''
AND a.tablename=' '