Index¶
CrossDB Index is used to implement database Primary Key and accelerate query.
Index Type¶
HASH Index
HASH
index has highest O(1) performance. It's optimized a lot to achieve best performance.HASH
index can dynamically scale with table rows number to get high performance.HASH
index only supports exact match.
RBTREE Index
- Use flag
CROSS_RBTREE
RBTREE
index is almost the same with popular RDBMS BTree, which is core index engine of RDBMS.RBTREE
index can support exact match, range match and leftmost prefix match with multiple-column.
Guide¶
- Default index is
HASH
type. - If one query matches both HASH index and RBTREE index, then Hash index is selected in most cases.
- You can create
HASH
index for high performance query andRBTREE
index for normal performance queries. - Index is not free, it occupies space and all inexes may be updated during INSERT/UPDATE/DELET row.
- If index is unique, please set
CROSS_UNIQUE
. - For unique index, either
insert
replace
update
will check row is unique. - You can do any query on any fields combination without index.
- Create index only when the query calls frequency is high and requires performance.