# Index Statistics

> Following is the definition of the `mco_index_stat_t` structure which provides memory usage statistics for an index:

>         typedef struct mco_index_stat_t_
>         {
>             uint2         class_code;             /* class code to which the index belongs */
>             uint4         type;                   /* type, MCO_IDXST_ flags */
>             char        * plabel;                 /* the index label */
>             mco_counter_t keys_num;               /* number of keys in the index */
>             mco_counter_t pages_num;              /* number of pages used by the index */
>             mco_counter_t avg_cmp;                /* average number of comparisons needed to locate an element */
>             mco_counter_t max_cmp;                /* maximum number of comparisons needed to locate an element */
>             union {
>                 mco_index_stat_tree_t   btree;     /* specific btree stats */
>                 mco_index_stat_kdtree_t kdtree;    /* specific kdtree stats */
>                 mco_index_stat_hash_t   hash;      /* specific hash stats */
>                 mco_index_stat_tree_t   ptree;     /* specific patricia trie stats */
>                 mco_index_stat_rtree_t  rtree;     /* specific r-tree stats */
>                 mco_index_stat_meta_t   meta;      /* specific meta-index stats */
>             } spec;
>         } mco_index_stat_t, * mco_index_stat_h;

> class_code | The class code to which the index belongs
> type | A bitmap of MCO_IDXST_ flags as defined below
> plabel | The index label
> keys_num | The number of keys in the index
> pages_num | The number of pages used by the index
> avg_cmp | The average number of comparisons needed to locate an element
> max_cmp | The maximum number of comparisons needed to locate an element
> spec | A union containing specific statistics depending on the type of index (see table below).

> The element type is defined by a combination of the following bit values:

> Type
> MCO_IDXST_TYPE_MEM | In-memory index
> MCO_IDXST_TYPE_DISK | Persistent index
> Nature
> MCO_IDXST_NATURE_BTREE | Binary tree
> MCO_IDXST_NATURE_PTREE | Patricia trie
> MCO_IDXST_NATURE_KDTREE | KD-tree
> MCO_IDXST_NATURE_HASH | Hash index
> MCO_IDXST_NATURE_META | Meta-index
> MCO_IDXST_NATURE_RTREE | R-tree
> Feature
> MCO_IDXST_FEATURE_UNIQUE | Unique
> MCO_IDXST_FEATURE_UDF | User-defined
> MCO_IDXST_FEATURE_THICK | Thick index
> MCO_IDXST_FEATURE_OPTIMIZED | Uses optimized compare & hash functions
> Function
> MCO_IDXST_FUNCTION_REGULAR | Regular class index
> MCO_IDXST_FUNCTION_OID | Object-ID meta-index
> MCO_IDXST_FUNCTION_AUTOOID | Auto object-ID meta-index
> MCO_IDXST_FUNCTION_AUTOID | Auto id meta-index
> MCO_IDXST_FUNCTION_LIST | List meta-index

> The union element spec is one of the following depending on the type of index: