This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com

Home

 
4D v20 R7
CREATE INDEX

CREATE INDEX  


 

 

 Command CREATE INDCREATE [UNIQUE] INDEX sql_name ON sql_name (column_reference, ... , column_reference)

The CREATE INDEX command is used to create an index (sql_name) on one or more columns of an existing table (sql_name) designated by one or more column_reference type arguments. Indexes are transparent to users and serve to speed up queries.

Note: The UNIQUE attribute is not supported for indexes by the 4D SQL engine. It can be passed to CREATE INDEX for compatibility with generic SQL scripts (no error is generated), but it will be ignored. Use UNIQUE keyword in column_definition of CREATE TABLE to disallow duplicate values in a column.

Since this command modifies the database structure, it cannot be used in the context of a read-only packaged application (.4dc file installed in the Program Files folder or .4dz file). 

Example  

Here is a simple example for creating an index:

CREATE INDEX ID_INDEX ON ACTOR_FANS (ID)



See also 

column_reference
DROP INDEX

 
PROPERTIES 

Product: 4D
Theme: SQL Commands

 
PAGE CONTENTS 
 
HISTORY 

 
ARTICLE USAGE

4D SQL Reference ( 4D v20 R7)