Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 10.0.1 » UltraLite - Database Management and Reference » Working with UltraLite Databases

Viewing entity-relationship diagrams from the UltraLite plug-in Next Page

Working with UltraLite indexes


An index provides an ordering (either ascending or descending) of a table's rows based on the values in one or more columns. When UltraLite optimizes a query, it scans existing indexes to see if one exists for the table(s) named in the query. If it can help UltraLite return rows more quickly, the index is used. If you are using the UltraLite Table API in your application, you can specify an index that helps determine the order in which rows are traversed.

Performance Tip

Indexes can improve the performance of a query—especially for large tables. To see whether or not a query is using a particular index, you can check the query access plan with Interactive SQL.

Alternatively, your UltraLite applications can include PreparedStatement objects which have a method to return plans.

About composite indexes

Multi-column indexes are sometimes called composite indexes. Additional columns in an index can allow you to narrow down your search, but having a two-column index is not the same as having two separate indexes. For example, the following statement creates a two-column composite index:

CREATE INDEX name
ON Employees ( Surname, GivenName )

A composite index is useful if the first column alone does not provide high selectivity. For example, a composite index on Surname and GivenName is useful when many employees have the same surname. A composite index on EmployeeID and Surname would not be useful because each employee has a unique ID, so the column Surname does not provide any additional selectivity.

See also

When to use an index
Choosing an index type
Adding UltraLite indexes
Dropping an index