Sybase: space used by the indexes on a table

In order to find the space used by a table (data and indexes) you can execute the following:

1> sp_spaceused mytable
2> go
 name    rowtotal reserved  data    index_size unused
 ------- -------- --------- ------- ---------- ------
 mytable 20612    103320 KB 7624 KB 95216 KB   480 KB

(1 row affected)
(return status = 0)

If you see that the indexes take much more space than expected, you can also use 1 as a second parameter to the sp_spaceused stored procedure:

1> sp_spaceused mytable,1
2> go
 index_name             size reserved unused
 ------------------ -------- -------- ------
 my_index_1           612 KB   736 KB 124 KB
 my_index_2          2840 KB  2864 KB  24 KB
 my_index_3           504 KB   536 KB  32 KB
 my_index_4          3016 KB  3032 KB  16 KB
 my_index_5          1144 KB  1152 KB   8 KB
 tmytable           87064 KB 87288 KB 224 KB
 mytable_key_index     36 KB  7712 KB  52 KB

(1 row affected)
 name    rowtotal reserved  data    index_size unused
 ------- -------- --------- ------- ---------- ------
 mytable 20612    103320 KB 7624 KB 95216 KB   480 KB
(return status = 0)

The tmytable entry are the text and image fields.

Leave a Reply

Your email address will not be published.