cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Correlating output of sp_spaceused procedure

HarshPatel1
Explorer
0 Kudos
565

We have an use-case to show table level space metrics. We came across 'sp_spaceused' and want to understand the metrics it shows like reserved, data, unused and index size.
The info doc says "The amount of space allocated (reserved) reported by sp_spaceused is a total of the data, index size, and available (unused) space."

https://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc36273.1572/html/sprocs/X...

But when trying it out, it is not the case (screenshot below for reference).

Am I missing something here?

image.png

HarshPatel1_0-1717408730047.png

 

Accepted Solutions (0)

Answers (1)

Answers (1)

Mark_A_Parsons
Contributor
0 Kudos

Without any details I'm guessing the difference is related to oam pages which could be part of a reserved extent but not usable for table/index storage.

If you want to dig into the details I'd recommend you run select spaceusage(db_id(),object_id('<table_name>') and then reference these values as you step through the source code for sp_spaceused to understand its output.

HarshPatel1
Explorer
0 Kudos

Here is the output of spaceusage

reserved pages=16, used pages=4, data pages=2, index pages=1, oam pages=2, allocation units=2, row count=2, tables=1, LOB pages=0

so you mean extra space 'reserved' is showing (besides total of data, index and unused) is the space occupied by these oam pages?