--- title: "CREATE INDEX (Transact-SQL)" description: The CREATE INDEX statement creates a relational index on a table or view. author: rwestMSFT ms.author: randolphwest ms.reviewer: wiassaf, dfurman ms.date: 02/05/2026 ms.service: sql ms.subservice: t-sql ms.topic: reference ms.custom: - ignite-2025 f1_keywords: - "CREATE INDEX" - "INDEX" - "INDEX_TSQL" - "CREATE_INDEX_TSQL" helpviewer_keywords: - "CREATE XML INDEX statement" - "PRIMARY XML INDEX statement" - "indexes [SQL Server], creating" - "online index operations" - "index keys [SQL Server]" - "PROPERTY INDEX statement" - "computed columns, index creation" - "clustered indexes, creating" - "indexed views [SQL Server], index creation" - "partitioned indexes [SQL Server], creating" - "VALUE INDEX statement" - "index creation [SQL Server], CREATE INDEX statement" - "DROP_EXISTING clause" - "row locks [SQL Server]" - "composite indexes" - "MAXDOP index option, CREATE INDEX statement" - "filtered indexes [SQL Server], creating" - "PATH INDEX statement" - "locking [SQL Server], indexes" - "unique indexes, creating" - "primary indexes [SQL Server]" - "CREATE PRIMARY XML INDEX statement" - "SET statement, index creation" - "index options [SQL Server]" - "included columns" - "ONLINE option" - "nonclustered indexes [SQL Server], creating" - "CREATE INDEX statement" - "IGNORE_DUP_KEY option" - "deterministic functions" - "keys [SQL Server], index" - "SECONDARY XML INDEX statement" - "page locks [SQL Server]" - "secondary indexes [SQL Server]" - "XML indexes [SQL Server], creating" dev_langs: - "TSQL" monikerRange: ">=aps-pdw-2016 || =azuresqldb-current || =azure-sqldw-latest || >=sql-server-2016 || >=sql-server-linux-2017 || =azuresqldb-mi-current || =fabric-sqldb" --- # CREATE INDEX (Transact-SQL) [!INCLUDE [sql-asdb-asdbmi-asa-pdw-fabricsqldb](../../includes/applies-to-version/sql-asdb-asdbmi-asa-pdw-fabricsqldb.md)] Creates a relational index on a table or view. Also called a rowstore index because it is either a clustered or nonclustered B-tree index. You can create a rowstore index before there is data in the table. Use a rowstore index to improve query performance, especially when the queries select from specific columns or require values to be sorted in a particular order. [!INCLUDE [sql-b-tree](../../includes/sql-b-tree.md)] [!INCLUDE[ssazuresynapse-md](../../includes/ssazuresynapse-md.md)] and [!INCLUDE[ssPDW](../../includes/sspdw-md.md)] currently don't support unique constraints. Any examples referencing unique constraints are only applicable to [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)], [!INCLUDE [ssazure-sqldb](../../includes/ssazure-sqldb.md)], [!INCLUDE [fabric-sqldb](../../includes/fabric-sqldb.md)], and [!INCLUDE [ssazuremi-md.md](../../includes/ssazuremi-md.md)]. For information on index design guidelines, refer to the [SQL Server index design guide](../../relational-databases/sql-server-index-design-guide.md). **Examples:** 1. Create a nonclustered index on a table or view ```sql CREATE INDEX index1 ON schema1.table1 (column1); ``` 1. Create a clustered index on a table and use a 3-part name for the table ```sql CREATE CLUSTERED INDEX index1 ON database1.schema1.table1 (column1); ``` 1. Create a nonclustered index with a unique constraint and specify the sort order ```sql CREATE UNIQUE INDEX index1 ON schema1.table1 (column1 DESC, column2 ASC, column3 DESC); ``` **Key scenario:** Starting with [!INCLUDE[sssql16-md](../../includes/sssql16-md.md)], in [!INCLUDE [ssazure-sqldb](../../includes/ssazure-sqldb.md)], [!INCLUDE [fabric-sqldb](../../includes/fabric-sqldb.md)], and in [!INCLUDE [ssazuremi-md.md](../../includes/ssazuremi-md.md)], you can use a nonclustered index on a columnstore index to improve data warehousing query performance. For more information, see [Columnstore indexes - data warehouse](../../relational-databases/indexes/columnstore-indexes-data-warehouse.md). For additional types of indexes, see: - [CREATE XML INDEX](../../t-sql/statements/create-xml-index-transact-sql.md) - [CREATE SPATIAL INDEX](../../t-sql/statements/create-spatial-index-transact-sql.md) - [CREATE COLUMNSTORE INDEX](../../t-sql/statements/create-columnstore-index-transact-sql.md) :::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: [Transact-SQL syntax conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md) ## Syntax ### Syntax for SQL Server, Azure SQL Database, SQL database in Fabric, Azure SQL Managed Instance ```syntaxsql CREATE [ UNIQUE ] [ CLUSTERED | NONCLUSTERED ] INDEX index_name ON ( column [ ASC | DESC ] [ ,...n ] ) [ INCLUDE ( column_name [ ,...n ] ) ] [ WHERE ] [ WITH ( [ ,...n ] ) ] [ ON { partition_scheme_name ( column_name ) | filegroup_name | default } ] [ FILESTREAM_ON { filestream_filegroup_name | partition_scheme_name | "NULL" } ] [ ; ] ::= { database_name.schema_name.table_or_view_name | schema_name.table_or_view_name | table_or_view_name } ::= { PAD_INDEX = { ON | OFF } | FILLFACTOR = fillfactor | SORT_IN_TEMPDB = { ON | OFF } | IGNORE_DUP_KEY = { ON | OFF } | STATISTICS_NORECOMPUTE = { ON | OFF } | STATISTICS_INCREMENTAL = { ON | OFF } | DROP_EXISTING = { ON | OFF } | ONLINE = { ON [ ( ) ] | OFF } | RESUMABLE = { ON | OFF } | MAX_DURATION =