List is a pointer which focuses to an area of information in the data set. Ordering is an idea used to rapidly find the information without looking through each record in a data set. OrientDB underpins four file calculations and a few sorts inside each.
The four sorts of record are −
SB-Tree Index
It gives a decent blend of highlights accessible from other list types. Better to utilize this for general utility. It is tough, value-based and bolsters range inquiries. It is default record type. The distinctive sort modules that help this calculation are −
- Novel − These files don't permit copy keys. For composite files, this alludes to the uniqueness of the composite keys.
- NOTUNIQUE − These records permit copy keys.
- FULLTEXT − These records depend on any single expression of text. You can utilize them in inquiries through the CONTAINSTEXT administrator.
- Word reference − These files are like those that utilization UNIQUE, however on account of copy keys, they supplant the current record with the new record.
Hash Index
It performs quicker and is light in plate use. It is solid, value-based, however doesn't uphold range inquiries. It works like HASHMAP, which makes it quicker on timely queries and it devours less assets than other file types. The diverse kind modules that help this calculation are −
- UNIQUE_HASH_INDEX − These records don't permit copy keys. For composite files, this alludes to the uniqueness of the composite keys.
- NOTUNIQUE_HASH_INDEX − These lists permit copy keys.
- FULLTEXT_HASH_INDEX − These lists depend on any single expression of text. You can utilize them in questions through the CONTAINSTEXT administrator.
- DICTIONARY_HASH_INDEX − These files are like those that utilization UNIQUE_HASH_INDEX, however in instances of copy keys, they supplant the current record with the new record.
Lucene Full Text Index
It gives great full-text lists, yet can't be utilized to record different sorts. It is sturdy, value-based, and underpins range questions.
Lucene Spatial Index
It gives great spatial lists, yet can't be utilized to record different sorts. It is strong, value-based, and bolsters range inquiries.
Creating Indexes
Make list is an order to make a list on a specific construction.
The accompanying assertion is the essential punctuation to make a file.
CREATE INDEX <name> [ON <class-name> (prop-names)] <type> [<key-type>]
[METADATA {<metadata>}]
Following are the insights concerning the alternatives in the above sentence structure.
<name> − Defines the coherent name for the list. You can likewise utilize the <class.property> documentation to make a programmed record bound to a pattern property. <class> utilizes the class of the diagram and <property> utilizes the property made in the class.
<class-name> − Provides the name of the class that you are making the programmed file to record. This class should exist in the information base.
<prop-names> − Provides the rundown of properties, which you need the programmed record to list. These properties should as of now exist in composition.
<type> − Provides the calculation and kind of record that you need to make.
<key-type> − Provides the discretionary key sort with programmed records.
<metadata> − Provides the JSON portrayal.
Example
Attempt the accompanying inquiry to make programmed record bound to the property 'ID' of the client sales_user.
orientdb> CREATE INDEX indexforID ON sales_user (id) UNIQUE
On the off chance that the above inquiry is executed effectively, you will get the accompanying yield.
Creating index...
Index created successfully with 4 entries in 0.021000 sec(s)
Querying Indexes
You can utilize select inquiry to get the records in the list.
Attempt the accompanying inquiry to recover the keys of list named 'indexforId'.
SELECT FROM INDEX:indexforId
In the event that the above inquiry is executed effectively, you will get the accompanying yield.
----+------+----+-----
# |@CLASS|key |rid
----+------+----+-----
0 |null |1 |#11:7
1 |null |2 |#11:6
2 |null |3 |#11:5
3 |null |4 |#11:8
----+------+----+-----
Drop Indexes
In the event that you need to drop a specific list, you can utilize this order. This activity doesn't eliminate connected records.
The accompanying assertion is the fundamental punctuation to drop a list.
DROP INDEX <name>
Where <name> gives the name of the list you need to drop.
Attempt the accompanying inquiry to drop a list named 'ID' of client sales_user.
DROP INDEX sales_users.Id
In the event that the above inquiry is executed effectively, you will get the accompanying yield.
Index dropped successfully