Doc­u­men­ta­tion/Graph Query Language

CREATE INDEX

The ‘CREATE INDEX’ state­ment cre­ates an index of a given type attribute.

CREATE [ UNIQUE ] INDEX identifier
[ EDITION identifier ]
ON identifier ( index_attribute_list )
[ INDEXTYPE identifier]
  • An index can be cre­ated by an iden­ti­fier name fol­lowed by an optional edi­tion name, the attribute name and an optional index type.
  • A UNIQUE index cre­ates a con­straint index such that all attribute val­ues inserted into the index must be dis­tinct. An error occurs if you try to add a new attribute value that matches an already exist­ing index key.
  • You can have mul­ti­ple indices on the same index_attribute_list using the ‘EDITION’ key­word. This allows you e.g. to have an ‘HashTable’ index for faster exact-match-lookups and a ‘BTree’ index for faster range-queries simul­ta­ne­ously. The query opti­mizer will select the appro­pri­ate index automatically.
  • You can cre­ate a new index named ‘IDX_Name’ for the attribute ‘Name’ of the object ‘User’ by using the state­ment: ‘CREATE INDEX IDX_Name ON User (Name) INDEXTYPE HashTable’.


index_attribute_list

identifier [ ASC | DESC ] [, identifier [ ASC | DESC ] ]
  • The ‘iden­ti­fier’ is the name of an attribute
  • ASC|DESC is the sort order of the index