SQL SERVER – Maximum Number of Index per Table

TechEd on Road Ahmedabad, June 20, 2009, was a huge success. This grand event saw over 200 attendees actively participating in the sessions. We had attendees traveling from far and wide, including Delhi, Mumbai, Jaipur, Kerala, Baroda, Himmatnagar, Rajkot, among other cities from India. This enthusiastic participation made the event truly grand. It was a moment of bliss for me as I had not anticipated such tremendous positive response!

Although the Official time to commence the event was at 1:45 PM we were really excited to see the attendees entering the hall before the official time. We were more than happy to quickly arrange a special session for those attendees who came in early to keep them engaged. They won loads of gifts while waiting for the official sessions to start. We had a brainstorming quiz session. I was happy to see that people in Ahmedabad are now taking keen interest in enhancing their knowledge.

One of the questions was – What is the maximum number of Index per table? I received lots of answers to this question but only two answers are correct. Let us now take a look at them.

For SQL Server 2005:
1 Clustered Index + 249 Nonclustered Index = 250 Index
http://msdn.microsoft.com/en-us/library/ms143432(SQL.90).aspx

For SQL Server 2008:
1 Clustered Index + 999 Nonclustered Index = 1000 Index
http://msdn.microsoft.com/en-us/library/ms143432.aspx

I would like to thank one of the attendees of Ahmedabad TechEd Kruti Kansara for the above comment.

Reference : Pinal Dave (https://blog.sqlauthority.com)

SQL Index
Previous Post
SQL SERVER – SQL Server Management Studio New Features
Next Post
SQL SERVER – 2008 – Policy-Based Management – Create, Evaluate and Fix Policies

Related Posts

49 Comments. Leave new

  • Imran Mohammed
    June 29, 2009 8:43 am

    SQL Server 2005 link is currently pointing to SQL Server 2000.

    Link for SQL Server 2005 :
    https://docs.microsoft.com/en-us/previous-versions/sql/sql-server-2005/ms143432(v=sql.90)

    ~ IM.

    Reply
  • Robert Miller
    June 29, 2009 9:45 am

    I think the maximum number of indexes on a table in 2008 is 1000 (1 Clustered + 999 Nonclustered Indexes).

    Reply
  • Pinal,

    It should be 1000 indexes for SQL Server 2008.

    Reply
  • I suppose you meant 100 indexes for SQL 2008 :)

    Reply
  • Yes, Imran is right. The link for SQL Server 2005 is referred to SQL Server 2000.

    Also I am little confused for SQL Server 2008 as it shows
    1 Clustered Index + 999 Nonclustered Index = 250 Index

    Is it not 1000 Index?

    Thanks,
    DV

    Reply
  • Your total for SQL2008 isn’t right either (1+999 = 1000).

    Of course the likelihood is that any table that hits the maximum limits is part of a bad design. Can anyone think of any scenario where even 250 nonclustered indexes might be necessary?

    Reply
  • A little fault in your addition:
    1 Clustered Index + 999 Nonclustered Index = 250 Index

    Must be 1000 Index ;-)

    Reply
  • Hi Friends,

    Can any one tell me why we cannot create more than 249 Non-Clustered Indexes??

    Thanks in advance,
    Vijay Vasudevan

    Reply
  • @Vijay: You are using SQL Server 2005, right? Read the post above or: https://docs.microsoft.com/en-us/previous-versions/sql/sql-server-2005/ms143432(v=sql.90)

    Reply
  • Can you tell me what’s the maximum number of unique indexes in a table in sql server 2005 ?

    Reply
  • @Darshan,

    There are no unique indexes in any version of SQL Server.

    There are basically two types of indexes.
    Clustered Indexes and Non-Clustered Indexes.

    In SQL Server 2005 :
    you can have
    1 Clustered Index on a table and
    249 Non Clustered Indexes.

    Reference: Books Online

    Follow this link :

    But, When ever you create a unique constraint on a column in a table, it automatically creates a non-clustered indexes.

    A unique Key constraint cannot be created with out an index, either the index could be Clustered or Non-Clustered.

    So your question could be, How many unique constraints you can have on a table or how many Non-Clustered indexes you can have on a table.

    Answer is 249. (Given, no other Non-Clustered index is created Separately)

    ~ IM.

    Reply
  • Kalyan Kumar Navana
    September 25, 2009 6:46 pm

    There are 2 types of indexes
    1. Clustered Indexes
    2. Non-clustered Indexes

    There can be only one Clustered index in a table
    and there can be 249 non-clustered indexes on a table

    Reply
    • Yogesh Goswami
      June 18, 2010 3:39 pm

      Well we can have a unique index. You just need to use Unique key word in Create Index statement.
      /*Sample script*/
      Use tempdb

      Create table test1 (col1 int, col2 int)
      Create unique index idx_uni1 on test1(col1)

      So in short, an index could be clustered and non-clustered as well as unique and non-unique(total 4 variations). A unique index will not allow duplicate entry in the table based on the index key columns.
      By default any index is non-cluster and non-unique unless specified otherwise in create statement.

      Reply
      • @Kalyan Kumar Navana
        Please specify the SQL version 2000/2005 or 2008 for the max no of index.

  • kailash Dhanke
    January 20, 2010 1:04 pm

    In SQL 2005

    1 Cluster Index
    249 Non Cluster Index

    Total 250
    ———————————–
    In SQL 2008

    1 Cluster Index
    999 Non Cluster Index

    Total
    1000

    Reply
  • Very Informative..!

    Reply
  • Good information. Thanks Pinal for sharing. Keep posting.

    Reply
    • Aniket Bhoyar
      March 27, 2010 2:29 pm

      Why can there be only 1 clustered index and not more than 1?

      Reply
      • Imran Mohammed
        March 28, 2010 2:37 am

        Cluster Index Physically Stores data, or arranges data in one order (depends on which column(s) you have defined Clustered index and in which order.

        As a fact we all know that set of data can be only stored in only one order, that is why only one clustered index is possible.

        You can create a view on top of table and then you can created Clustered index on that view.

        Hope this helps.
        ~ IM.

  • Two questions:

    * What’s the number of indexes in SQL Server ?
    * Do statistics occupy ‘slots’ of this number. In other words clusterd index + non clustered + statistcs = 250 (SQL 2000/SQL 2005?)

    Reply
  • Two questions:

    * What’s the number of indexes in SQL Server 2000 ?
    * Do statistics occupy ’slots’ of this number. In other words clusterd index + non clustered + statistcs = 250 (SQL 2000/SQL 2005?)

    thnx!

    Reply
    • Gennadiy Chornenkyy
      January 17, 2011 11:49 pm

      Looks like yes – if you try to create index on table with max number of statistics you’ll get en error message

      Reply
  • As ever Pinal, you’re so helpful!

    Thanks a lot, Josh.

    Reply
  • Srinivas Kadiyala
    October 13, 2011 4:40 pm

    Thanks :)

    Reply
  • Why we have 249 non clustered index in sql server 2005? why not 240 or 300? and the same question for sql server 2008, why 999 ? Why not 800 or 1000?

    Reply
    • the total indexes are 250 (including 1 clustered index) for 2005 and 1000 (including 1 clustered index) from version >2005. So they are 250 and 1000 in total

      Reply

Leave a Reply