Monday, March 27, 2017

What is index and what are the uses?

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.

No comments:

Post a Comment

Call a function in child component from parent component in React

Consider the following parent component class Parent extends React.Component { constructor(props) { super(props);         thi...