CREATE INDEX
The CREATE INDEX
statement creates a sorted, hash, or bitmap index for a given map.
|
Syntax Summary
This code block is a quick reference with all the parameters that you can use with the CREATE MAPPING
statement.
See some practical examples.
CREATE INDEX [ IF NOT EXISTS ] index_name
ON map_name ( attribute_name [, ...] )
[ TYPE index_type ]
[ OPTIONS ( 'option_name' = 'option_value' [, ...] ) ]
Parameters
The CREATE INDEX
statement accepts the following parameters.
You must provide the following:
-
index_name
-
map_name
-
attribute_name
Parameter | Description |
---|---|
|
Create a new index only if an index of the same name does not already exist (recommended). |
|
Name of the index. This name must be unique. The |
|
Name of the map to index |
|
Names of the map’s fields to index. The |
|
One of the following index types:
For details about these index types, see Indexing Maps. |
|
Configuration options for
For details, see Bitmap Indexes. |
Permissions
Enterprise Edition
If security is enabled, you can grant or deny permission for certain clients to use this statement. See SQL Permissions.
Examples
This section lists some example SQL queries that show you how to use the CREATE INDEX
statement.
CREATE INDEX IF NOT EXISTS age
ON employees (age)
TYPE SORTED
CREATE INDEX IF NOT EXISTS name_age
ON employees (name, age)
TYPE SORTED
CREATE INDEX IF NOT EXISTS name
ON employees (name)
TYPE HASH
CREATE INDEX IF NOT EXISTS firstName
ON employees ("name.first")
TYPE BITMAP
OPTIONS (
'unique-key' = '__key'
)