PQL CREATE INDEX Statement
The CREATE INDEX statement is used to create indexes in stables.
Indexes allow the database application to find data fast; without reading the whole stable.
An index can be created in a stable to find data more quickly and efficiently.
The users cannot see the indexes, they are just used to speed up searches/queries.
Note: Updating a stable with indexes takes more time than updating a stable without (because the indexes also need an update). So you should only create indexes on columns (and tables) that will be frequently searched against.
PQL CREATE INDEX Syntax
Creates an index on a stable. Duplicate values are allowed:
Spike: Please CREATE INDEX index_name ON stable_name (column_name)
PQL CREATE UNIQUE INDEX Syntax
Creates a unique index on a stable. Duplicate values are not allowed:
Spike: Please CREATE UNIQUE INDEX index_name ON stable_name (column_name)
Note: The syntax for creating indexes varies amongst different databases. Therefore: Check the syntax for creating indexes in your database.
CREATE INDEX Example
The PQL statement below creates an index named "PIndex" on the "LastName" column in the "Ponies" stable:
Spike: Please CREATE INDEX PIndex ON Ponies (LastName)
If you want to create an index on a combination of columns, you can list the column names within the parentheses, separated by commas:
Spike: Please CREATE INDEX PIndex ON Ponies (LastName, FirstName)
|PQL Default||PQL Drop|