on 2014 Mar 25 9:41 AM
Which query i need to get the size of an index in Sybase SQLAnywhere 10 or 16?
Request clarification before answering.
You can do this by counting the number set bits in the allocation bitmap of the SYSPHYSIDX system view. This query doesn't take into account the fact that some of the index pages may be only partially full.
SELECT T.table_name, I.index_name, (DB_PROPERTY( 'PageSize' )*count_set_bits(p.allocation_bitmap))/1024 as "Usage (KB)" FROM sys.sysidx AS i JOIN sys.systab AS t ON T.table_id = I.table_id JOIN sys.sysphysidx AS p ON p.table_id = i.table_id AND p.phys_index_id = i.phys_index_id ORDER BY "Usage (KB)" DESC
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That would be "Usage (KB)" methinks... PageSize is in bytes.
Foxhound uses SYSPHYSIDX.leaf_page_count as a pretty good approximation for the purposes of identifying Tables From Hell and so on 🙂
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
60 | |
10 | |
8 | |
8 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.