May 23, 2006 at 7:47 am
Hi DBA's,
I had the below question in the Microsoft technical interview.
Why a table has only 249 non-clustered index and not more than that?
I had no clue..but would like to know if someone could answer the same... 🙂
Thanks !
May 23, 2006 at 11:16 am
Wrong forum, this is the Notification Services forum.
May 24, 2006 at 7:07 am
Each PRIMARY KEY and UNIQUE constraint generates an index. The number of UNIQUE and PRIMARY KEY constraints cannot cause the number of indexes on the table to exceed 249 nonclustered indexes and 1 clustered index.
May 24, 2006 at 8:17 am
The question is WHY?.. and for one I'd like to know to .
May 24, 2006 at 9:40 am
From BOL (searching for Table and Index Architecture)
"Each table has a set of rows in sysindexes:
A heap has a row in sysindexes with indid = 0.
A clustered index on a table or view has a row in sysindexes with indid = 1.
Each nonclustered index created for a table or view has a row in sysindexes.
The values for indid in the rows for each nonclustered index range from 2 through 250.
Each table that has at least one text, ntext, or image column also has a row in sysindexes with indid = 255. "
Explains why the 249 limit but doesn't really explain why have a limit or does it?
May 24, 2006 at 9:41 am
That's exactly what was asked by Microsoft.
WHY is the limitation ??? There should be some LOGIC....
Hope to get more clue on to it....
By the way... I already got into the JOB in MS 🙂
Shud thank ALL you folks as well for the help !!!
May 24, 2006 at 10:23 am
Funny thing is that the indid column in sysindexes is defined as a smallint, thus they could have gone up to 32,767.
I bet it has something to do with using 8 bits somewhere since 2 to the power 8 = 255.
But now that you are in MS - Please do let us know what you find out.
May 24, 2006 at 2:26 pm
This is more of a rhetorical question. The 249 limit obviously has to do with a smallint datatype. BUT I can't imagine why a normalized database would need that many indexes!
May 26, 2006 at 11:43 am
Smallint is 16 bits, d_vis. Perhaps you are thinking of tinyint?
I partially agree, though. What need could there possibly be, on a single table, for more than 249 indexes? Seems to me there is a normalization problem somewhere or just a bunch of unneeded indexes.
Remember that indexes have diminishing returns, the more of them you add, if you are constantly inserting and updating data on your table.
I also partially agree with the other argument on here, though. Why is there a limit in the first place? Seems odd to artificially impose limits like that if there is no reason other than lack of foresight ("millennium bug," anyone?).
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply