What is index and explain its purpose.
An index is typically used to retrieve records of a table at a faster rate. This is because an index contains value of the indexed column.
Example:The example below creates an index student_idx in table student for column student_name
CREATE INDEX student_idx
ON student (student_name);
What is index and explain its purpose.
- An index is a pointer to a location of data.
- The purpose of an index is to make SQL queries run faster.
- If the optimizer detects an index that matches part of the WHERE clause of the query, then it uses the index to avoid having to read every row in the table.