Why we create an Index which consumes extra additional storage to database?
Irrespective of consuming an additional storage area on the database Indexes provides much better performance when it comes to retrieving records from a huge database.
Here below are some some of the reasons we create Index:
In order to save time from full table scan we create Index,
This makes easier to search only in the unique single column values.
Index also has the corresponding rowid(pseudo collumn) with it,
so once it gets the requested value in the index collumn,
it's corresponding rowid retrieves the desired row from the base table and gives the output.
Index maintenance - Index automatically gets refreshed with the base table manipulations.
Irrespective of consuming an additional storage area on the database Indexes provides much better performance when it comes to retrieving records from a huge database.
Here below are some some of the reasons we create Index:
In order to save time from full table scan we create Index,
This makes easier to search only in the unique single column values.
Index also has the corresponding rowid(pseudo collumn) with it,
so once it gets the requested value in the index collumn,
it's corresponding rowid retrieves the desired row from the base table and gives the output.
Index maintenance - Index automatically gets refreshed with the base table manipulations.
Syntax for creating an Index
Create Index index_name on table(collumn_name);
Example of creating index on emp table
Create Index my_index on emp(empno);
No comments:
Post a Comment