CREATE INDEX (bSQL) | Blockpoint Docs
Creates a user defined index on the specified blockchain. For examples, see Examples.
Syntax​
CREATE INDEX "index_name" index_type
ON {
<object>
<column_list>
}
<object> ::=
{ database_name.blockchain_name | blockchain_name }
<column_list> ::=
(column_name, ...)
Arguments​
index_name
The name of the index created.
index_type
The index type to be created, for more about bSQL indexes see the index overview.
Index Types:​
ALT1
: Enforces uniqueness and uses the column key to find the record referenced at that key.ALT2
: Enforces uniqueness and uses the column key to find the record ID reference at the key.ALT3
: Enforce uniqueness and uses the column key to find all records that correspond to that key.ALT3RID
: Enforces uniqueness and uses the column key to find all record IDs that correspond to that key.
database_name
The name of the database.
blockchain_name
The name of the blockchain.
column_name
The name of the to column(s) to create the index on.
Permissions​
ALTER
permissions required on the target blockchain.
ALTER
permissions default to members of the admin and developer fixed database roles. Members of the admin fixed database role can transfer permissions to other users.
Examples​
Creating an index on a blockchain.​
The following example creates a ALT3
index over the sector
column on the companies
blockchain in the financial
database. This example uses the Demo Database.
CREATE INDEX "sector tracker" ALT3
ON financial.companies (sector);