Indexes are used to retrieve data from the database very fast. The users cannot see the indexes, they are just used to speed up searches/queries.
Without an index when we run a select query on a Customer database with three columns customername, customerage and customerphonenumber with 1000 records to look for customer name “John”, the database software would literally look at each and every row of the database. Even if it finds “John” it would still look at remaining rows because there may be other customers too with same name.
So, to make this kind of searches fast we make of indexes. Indexing is a way of sorting several records on multiple fields. When we create an index on a field in a table it will create another data structure which holds the field value, and pointer to the record it relates to. This index structure is then sorted, allowing Binary Searches to be performed on it.
Indexes are used to retrieve data from the database very fast. The users cannot see the indexes, they are just used to speed up searches/queries.
Without an index when we run a select query on a Customer database with three columns customername, customerage and customerphonenumber with 1000 records to look for customer name “John”, the database software would literally look at each and every row of the database. Even if it finds “John” it would still look at remaining rows because there may be other customers too with same name.
So, to make this kind of searches fast we make of indexes. Indexing is a way of sorting several records on multiple fields. When we create an index on a field in a table it will create another data structure which holds the field value, and pointer to the record it relates to. This index structure is then sorted, allowing Binary Searches to be performed on it.
So, to make this kind of searches fast we make of indexes. Indexing is a way of sorting several records on multiple fields. When we create an index on a field in a table it will create another data structure which holds the field value, and pointer to the record it relates to. This index structure is then sorted, allowing Binary Searches to be performed on it.