# DDL Access Statements

> Access statements define the access methods that will be generated for the class. Access methods will be generated for oids, autoids, indexes, and lists.

> An index definition can include any combination of fields, structure elements or vector elements from a given class. eXtremeDB supports a rich set of indexes: tree (BTree), trie (Patricia Trie), kdtree (Multi-dimensional), rtree (Spatial Search), trigram (Trigram Search), inclusive (Covering index) and hash (Hash table). Tree indexes can be used for pattern matching, range retrieval and ordered (sorted) retrieval. Patricia trie indexes can be used for optimal access of IP addresses and similar alphanumeric strings, kdtree indexes for multi-dimensional key values and rtree indexes for spatial searches, trigram indexes for text searches when the exact spelling is not known, and “inclusive” or “covering” indexes can be used to reduce extra lookups by including the desired data field(s) in the index.

> Hash indexes are more efficient for exact match searches than tree indexes within in-memory databases, and can only be used for exact match searches or unordered list retrieval. When a tree-based (including rtree and kdtree, but not Patricia trie) index is declared, the additional unique qualifier can be specified. Hash indexes can be declared nonunique to allow duplicate values to be stored with the same hash table entry. Unique indexes must contain a unique combination of field values for that index. The runtime will recognize an attempt to create a duplicate and refuse to do so (emitting a MCO_S_DUPLICATE status code). Tree and kdtree indexes can optionally specify ascending or descending order for each element of the index (the default is ascending).

> Hash indexes require the extra parameter expected-number-of-entries following the index name. It is an integer number that the runtime uses to allocate the initial hash table for the index. It must be specified but is not required to be exact (the runtime will automatically allocate additional hash table space if necessary).