The records which have similar characteristics are grouped, and indexes are created for these group.Įxample: suppose a company contains several employees in each department. This method is called a clustering index. In this case, to identify the record faster, we will group two or more columns to get the unique value and create index out of them.Sometimes the index is created on non-primary key columns which may not be unique for each record. A clustered index can be defined as an ordered data file.In this, instead of pointing to each record in the main table, the index points to the records in the main table in a gap.In the data file, index record appears only for a few items.The index records have the search key and a pointer to the actual record on the disk. It needs more space to store index record itself.In this, the number of records in the index table is same as the number of records in the main table.The dense index contains an index record for every search key value in the data file.The primary index can be classified into two types: Dense index and Sparse index.As primary keys are stored in sorted order, the performance of the searching operation is quite efficient.These primary keys are unique to each record and contain 1:1 relation between the records. If the index is created on the basis of the primary key of the table, then it is known as primary indexing.In the case of an index, we will search using indexes and the DBMS will read the record after reading 542*2= 1084 bytes which are very less compared to the previous case.The DBMS will read the record after reading 543*10=5430 bytes. In the case of a database with no index, we have to search the disk block from starting till it reaches 543. If their IDs start with 1, 2, 3.and so on and we have to search student with ID-543. The indices which are sorted are known as ordered indices.Įxample: Suppose we have an employee table with thousands of record and each of which is 10 bytes long. The indices are usually sorted to make searching faster. It contains a set of pointers holding the address of the disk block where the value of the particular key can be found.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |