In DB2, Index is critical object to improve the search performance when you access Table data. The index is like searching key word in a book at the end you can see.
The point is you can create any number of indexes on a table.
Related Articles
The UNIQUE in create index is to enforce uniqueness when you enter data. That means it will not allow duplicate entries on that column. This is the main benefit of UNIQUE.
Also read:
- 32 top complex SQL queries
The second point…
What will happen when Index created on empty table.
Then, the index table will not be updated. So the index table is empty.
What will happen when index created on Table which has already data.
Then, Index table will be updated with entries.
The index disadvantage
If a large number of indexes are Created for a table that is modified frequently, overall performance will decrease.
Any time when Index is created on a existing table, if data is compromised, it will generate an error.
References and resources
- Online DB2 practice
- Three minute SQL Quiz