 |
|
ss
Oracle Tips by Burleson |
Indexes
So, you go to the library to find a book to
read. It is summer, and you have time on your hands and are not
sure what you want. You probably browse the shelves looking for
something that might interest you. When you’re not sure what you
want, this is a pretty easy access method, browsing the shelves.
But a database never browses for a row. It is always looking for a
particular row or rows.
So, let’s go back to the library and look
for a particular book. In this instance, you would not go and
browse the shelves; you would head for the card catalog. It could
take you hours to find a book by searching the shelves, while it
will take only minutes to look up the book and go directly to the
shelf where the book is located. This is because all of the books
in the library are numbered using the Dewey Decimal system.
Sometimes, you are not sure which book you want but know the general
subject. You can look up the subject in the card catalog and then
go to the shelves and look at a range of books.
Oracle uses basically the same system,
except that the card catalog is an index and the book number becomes
the rowid. When a query asks for a specific row of data, an index
allows the database to look up the rowid of that specific row and
directly retrieve it. Otherwise, the database must start at the
beginning of the table and check each row to find the data it wants.
The above book excerpt is from:
Easy Oracle
SQL
Get Started
Fast writing SQL Reports with SQL*Plus
ISBN 0-9727513-7-8
John Garmany
http://www.rampant-books.com/book_2005_1_easy_sql.htm |