Reputation: 568
I've been searching on the net for the types of database indexes, but I haven't found a real answer. Most of the pages say that there are two types (Clustered and Non-Clustered) but some others say different terms like (Simple, composite, B-tree, Bitmap, unique, non-unique, FBI, Dense, Sparse, Reverse, ...etc).
I know its different between DBMSs but why most of the sources there are just two types (Clustered and Non-Clustered)? What are types of indexes supported by SQL?
Can someone give me more explanation?
Upvotes: 1
Views: 1223
Reputation: 368
This is not a simple reply. I try to explain the topic in some paragraph and I'll speak about SQL Server, as a RDBMS..
When we speak about Clustered/Nonclustered and heaps (hobt --> heaps or b-tree) we're indicating "structures" in which objects (tables or indexed views) are stored. Indeed, heaps are simple "list" of items, stored without any particular order; clustered are structures which "organize" row data in trees (called b+tree) sorted by the index key and they are the objects themselves (a table can be a heap or a clustered structure); nonclustered are similar to the clustered structures, but they don't represent the tables (nor indexed views). They're additional structures which point to the clustered or heap underlying object.
Recap
A table (or an indexed view) can be stored in heaps or clustered (SQL Server can have just one clustered structure). A table (or an indexed view) can have more than one additional structures as nonclustered index in order to have more than one kind of accessing data. Every nonclustered index will point to the heap or to the clustered underlying object, depending on how the data are organized (it depends on whether you've created a clustered or not)
That said, we can say that non heap structures can support various kind of index:
The indexes above are the most used (in my experience) but we can add also:
Finally you can have also a set of concepts about indexes, which are not type of indexes, but you can hear about them:
Hope this helps.
Upvotes: 3
Reputation: 96552
Depends on what you mean by types of indexes. Every index has to be either clustered or nonclustered and only one index in a table can be clustered. However there are special types of indexes that have other properties as well such as being unique or having multiple fields in the index (a compound index), etc.
Upvotes: 0