Database indexing with example


What is database indexing? Think of your textbook index. In textbook index all important topic/key you found their. Database index is same as textbook index.Consider the image above, Using some branch name we created a index file. This index file we use to search any branch name in the database table and their associated information. So using index we can easily search any information in the database. There are two basic kinds of indices.
Ordered Indices: Based on a sorted ordering of the values.
Hash Indices: In hash index we uses a search key and it's associated pointer. We store the search key and associated pointers in a backet and use a hash function to identify the bucket.
Ordered Indices:
Ordered index means an index file, keys are organized in sorted order. If the search keys ordered in sequentially we call it primary index. And if the search key ordered in different from sequential order of the file are called secondary indexes.
Consider the figure  the index file search key is sequentially ordered. So it is primary index. In the same file I ordered this index file key Redwood, Brighton, Mianus. That is not sequentially ordered. So it is secondary indexes.   

Comments

Popular posts from this blog

How to construct a B+ tree with example

How to show only month and year fields in android Date-picker?

Visitor Counter Script Using PHP