|
SECONDARY INDICES
Tables can have one or more indices, each indexing a single column family. Two types of indices exist: a cell value index, which optimizes scans on a single column family that do an excact match or prefix match of the cell value, and a qualifier index, which optimizes scans on a single column family that do an exact match or prefix match of the column qualifier. The use of indices is optional.
The indices are stored in an index table which is created in the same namespace as the primary table and has the same name with one (cell value index) or two (qualifier index) caret signs (`^`) as a prefix.
A column family can have both types of indices (cell value index and qualifier index) at the same time. The following HQL command creates a table with three column families (a, b and c). Column family a has a cell value index, column family b has a qualifier index and c has both.- CREATE TABLE foo (
- a,
- b,
- c,
- INDEX a,
- QUALIFIER INDEX b,
- INDEX c,
- QUALIFIER INDEX c,
- );
复制代码 |
|