MSSQL: Create Nonclustered Index

Below script for performing index creation in MSSQL. We can see the use of TEMPDB and MAXDOP setting. From my experiences it’s worth to try because performance and indexing speed is better.

USE [testdb]
GO
CREATE NONCLUSTERED INDEX [index_name]
ON [dbo].[test_table] ([table_key],[other_column])
INCLUDE ([column1],[column2],[column3],[column4])
WITH (SORT_IN_TEMPDB = ON, MAXDOP=5)
GO
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s