Subquestion to my question [1]:
All definitions of (MS SQL Server) index (that I could find) are ambiguous and all explanations, based on it, narrate something using undefined or ambiguously defined terms.
What is the definition of index?
For ex., the most common definition of index from wiki (http://en.wikipedia.org/wiki/Index_(database) ) :
- 1) "A database index is a data structure that improves the speed of data retrieval operations on a database table at the cost of slower writes and increased storage space. Indexes can be created using one or more columns of a database table..."
- 2) "SQL server creates a clustered index on a primary key by default[1]. The data is present in random order, but the logical ordering is specified by the index. The data rows may be randomly spread throughout the table. The non-clustered index tree contains the index keys in sorted order, with the leaf level of the index containing the pointer to the page and the row number in the data page"
Well, it is ambiguous. One can understand under index:
- 1) an ordered data structure, a tree, containing intermediate and leaf nodes;
- 2) leaf node data containing values from indexed columns + "pointer to the page and the row number in the data page"
Can non-clustered index be non-unique, considering 2)? or, even, 1) ?
It doesn't seem so to me ...
But does TSQL imply existence of non-unique non-clustered index?
If yes, then What is understood by non-clustered index in "CREATE INDEX (Transact-SQL)"[2] and to what the argument UNIQUE is applied there?
Is it:
- 3) leaf node data containing values from indexed columns? i.e. like in 2) but without pointer + row number ) ?
If it is 3), then again question 1) arises - why to apply constraints to copy of real data in "index", instead of real data in-situ?
Update:
Is not bookmark (pointer+row number) to a real data row unique (uniquely identify row)?
Doesn't this bookmark constitute part of the index and thereby makes the index unique?
Can you give me the definition of the index instead of explaining how to use it UNDEFINED? The latter part I already know (or can read myself).
[1]
"UNIQUE argument for INDEX creation - what's for?"
http://stackoverflow.com/questions/3799095/unique-argument-for-index-creation-whats-for
[2]
[CREATE INDEX (Transact-SQL)]
http://msdn.microsoft.com/en-us/library/ms188783.aspx