Tuesday, August 16, 2022

What is Database Engine and Query Processor?

        1. What is Database Engine? 

  •  It is the heart of the DBMS. It stores, updates, and retrieves data. It also increases the speed and scalability of a database.

          2. What is Query Processor? 

  • It is the functional component of DBMS. It’s function is to break down query statement (given by user) into instruction understood by the DBMS. It helps the database system to access and update data.


1. Clustering:

 The method of storing logically related records physically together is called clustering. In this process, if the page containing the requested record is already in the memory, retrieval from the disk is not necessary. In such a situation, time taken for the whole operation will be less. Thus, if records which are frequently used together are placed physically together, more records will be in the same page. 

Hence, the number of pages to be retrieved will be less and this reduces the number of disk accesses which in turn gives a better performance. 

For example: Assume that the customer record size is 128 bytes and the typical size of a page retrieved by the file manager is 1KB (1024 bytes). If there is no clustering, it can be assumed that the customer records are stored at Random physical locations. In the worst case scenario, each record may be placed in a different page.

 Hence, a query to retrieve 100 records with consecutive customer id’s (say 1000, 10002) will require 100 pages to be accessed, which in turn translates to 100 disk accesses. 

 But, if the records are clustered, a page can contain 8 records. Hence, the no. of pages to be accessed for retrieving the 100 consecutive records will be ceil (100/8) =13 i.e. only 13 disk accesses will be required to obtain the query results. Thus, in the above example, clustering improves the speed by a factor of 7.7

  •  There are two types of clustering: 
  1.  Intra-file clustering.
  2.  Inter-file clustering 


  1.  Intra-file clustering: 
  •    When clustered records belong to the same files (tables), this is called intra-file         clustering.

 2. Inter-file clustering:
  • When clustered records belong to different files (tables), this is called inter-file clustering. This type of clustering may be required to enhance the speed of queries retrieving related records from more than one table. Here, interleaving of records is used.

No comments:

Post a Comment