Question { 4819 }
Give the reasoning behind using an index.
Answer
Its as simple as why do we need an index page in front of a
book. Whenever we wish to read a scpecific text from the
book, we'll first check the index and locate where that
specific text is. Similarly when create an index it enables
the queries to locate praticular row or entity in a table
by directly refering to the index instead of searching the
entire table. Whenever a table is created with a primary
key, an index ia automatically created on the primary key
column which makes easier access of table entries. When you
execute query say( select * from student where
student_id=10;), your query will first hit the index
(primary index on primary key column) and then will retrive
the corresponding row from the table. If there's no such
entry in the table, it'll return an empty result set
without searching the table.