Skip to main content

5. INDEX



§
Indexes are special lookup tables that the database search engine can use to speed up data retrieval.
§ An index can be created in a table to find data more quickly and efficiently.
§ An index helps speed up SELECT queries and WHERE clauses, but it slows down data input, with UPDATE and INSERT statements.
§ Indexes can be created or dropped with no effect on the data.
§ Updating a table with indexes takes more time than updating a table without (because the indexes also need an update).

Clustered indexes

§ Uses physical memory.
§ Easy to retrieve data.
§ Data is in stored form.

Non-clustered indexes

§ No use of physical memory is needed.
§ More complicated, data retrieval is not that easy.
§ We can toocreateuniqueindex.Duplicatevalues are not allowed.

CREATEINDEXindex_name
ONtable_name(column_name)

CREATEINDEXindex_name
ONtable_name(column_name)
CREATEINDEXPindex

Difference between clustered index and non-clustered index

         Clustered index
        Non-clustered index
One table can only have one clustered index
It can have more than one non clustered index

























<<Prev                                                                                   Next>>






Comments