The UNIQUE attribute ensures that there will not be two rows in the table with identical values in all the columns in
the index. Each index key must be unique or contain a NULL in at least one column.
There is a difference between a unique constraint on a table and a unique index. Columns of a unique index are allowed to
be NULL, while columns in a unique constraint are not. A foreign key can reference either a primary key or a unique constraint,
but not a unique index, because it can include multiple instances of NULL.
If the columns in a unique constraint are changed during an update, and a foreign key references that unique constraint, any
rows no longer referencing rows in the unique constraint are deleted from the remote.
IF NOT EXISTS clause
When the IF NOT EXISTS attribute is specified and the named index already exists, no changes are made and an error is
An ordered list of columns. Column values in the index can be sorted in ascending or descending order.
WITH MAX HASH SIZE
Sets the hash size (in bytes) for this index. This value overrides the default MaxHashSize property in effect for the
database. This is not supported by UltraLite Java edition databases. To learn the default size, see Reading database properties.
UltraLite automatically creates indexes for primary keys and for unique constraints.
Indexes can improve query performance by providing quick ways for UltraLite to look up specific rows. Conversely, because
they have to be maintained, indexes may slow down synchronization and INSERT, DELETE, and UPDATE statements.
Indexes are automatically used to improve the performance of queries issued to the database, and to sort queries with an ORDER
BY clause. Once an index is created, it is never referenced in a SQL statement again except to remove it with DROP INDEX.
Indexes use space in the database. Also, the additional work required to maintain indexes can affect the performance of data
modification operations. For these reasons, you should avoid creating indexes that do not improve query performance.
UltraLite does not process requests or queries referencing the index while the CREATE INDEX statement is being processed.
Furthermore, you cannot execute CREATE INDEX when the database includes active queries or uncommitted transactions.