Directory
eXtremeDB_rt/samples/dbstatDescription
How to see class- and index-related statistics
Used API
mco_class_stat_get(), mco_index_stat_get(), mco_index_stat_num()
Code snippet
rc = mco_trans_start(db, MCO_READ_ONLY, MCO_TRANS_FOREGROUND, &t); if ( MCO_S_OK == rc ) { while ( MCO_S_OK == mco_class_stat_get( t, j, &stat ) ) { char * name = ""; .... printf( "%25s %4d object(s), %4d page(s)\n", name, (int)stat.objects_num, stat.core_pages ); j++; .... } mco_trans_commit(t); } rc = mco_trans_start(db, MCO_READ_ONLY, MCO_TRANS_FOREGROUND, &t); if ( MCO_S_OK == rc ) { mco_index_stat_num( t, &cnt ); for ( j=0; j < cnt && MCO_S_OK == rc; j++ ) { rc = mco_index_stat_get( t, j, &stat ); if ( MCO_S_OK == rc ) { printf( "%25s %4d key(s) %4d page(s)\n\t\t\t", stat.plabel, (int)stat.keys_num, (int)stat.pages_num );What to expect as an output
Insert test records HashedObj 10 object(s), 1 page(s) TriedObj 11 object(s), 1 page(s) ListedObj 12 object(s), 1 page(s) AutoidedObj 13 object(s), 1 page(s) OIDedObj 14 object(s), 1 page(s) ComplexObj 15 object(s), 2 page(s) OID index 29 key(s) 83 page(s) inmem btree Regular levels=0 HashedObj.hkey 10 key(s) 83 page(s) inmem hash unique Regular max chain length=1 TriedObj.tkey 11 key(s) 1 page(s) inmem btree Regular levels=0 ListedObj.list_index_ 12 key(s) 1 page(s) inmem btree unique List levels=0 AutoidedObj.autoid 13 key(s) 128 page(s) inmem hash unique AutoID max chain length=1 ComplexObj.hkey 15 key(s) 83 page(s) inmem hash unique Regular max chain length=1 ComplexObj.tkey 15 key(s) 1 page(s) inmem btree Regular levels=0 ComplexObj.autoid 15 key(s) 128 page(s) inmem hash unique AutoID max chain length=1 ComplexObj.list_index_ 15 key(s) 1 page(s) inmem btree unique List levels=0