Simple Indexes
A simple index is a secondary index that has only one indexed field and zero or more included fields. Simple indexes enable you to optimize queries that filter and sort on a single field. If all fields referenced in a query are either indexed or included fields in a simple index, then you can process the query by reading only the index.
Sort Order
HPE Ezmeral Data Fabric Database sorts simple indexes on the single indexed field. HPE Ezmeral Data Fabric Database sorts the indexed field values in ascending order by default, although you can specify a descending order when you create the index. Sorting indexes benefits your ORDER BY queries because the index eliminates the need for a SORT operator in the query plan.
Simple Index Examples
The following CLI commands demonstrate how you can create various types of simple indexes. For these examples, assume that you have a HPE Ezmeral Data Fabric Database JSON table with the following sample data:
{
"_id": "10000",
"FullName": {
"LastName": "Smith",
"FirstName": "John"
},
"Address": {
"Street": "123 SE 22nd St.",
"City": "Oakland",
"State": "CA",
"Zipcode": "94601-1001"
},
"Gender": "M",
"AccountBalance": 999.99,
"Email": "john.smith@company.com",
"Phones": [
{"Type": "Home", "Number": "555-555-1234"},
{"Type": "Mobile", "Number": "555-555-5678"},
{"Type": "Work", "Number": "555-555-9012"}
],
"Hobbies": ["Baseball", "Cooking", "Reading"],
"DateOfBirth": "10/1/1985"
}
CLI Command | Description |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|