Professional Documents
Culture Documents
Contents
[hide]
• 1 2.1 Overview
• 2 2.2 Driver Interfaces
• 3 2.3 SQL Engine
• 4 2.4 Transaction Engine
• 5 2.5 Relational Engine
• 6 2.6 Storage Engine
• 7 2.7 SELECT Execution Sequence
• Interface Drivers
• SQL Engine
• Transaction Engine
• Relational Engine
• Storage Engine
Figure 1 contains DBMS components, Memory layout and disk files associated with
relational database management system. From early days of database system evolution,
disk is considered to be the backing store for the data to achieve durability. The
architecture above applies for disk resident database systems (DRDB). Nowadays there
are two different approaches other than DRDBs. They are
Most of the components in the DRDB system architecture above are present in main
memory and network databases as well.
[edit] 2.2 Driver Interfaces
A user or application program shall initiate either schema modification or content
modification. These application requests are broadly classified by SQL as Data Definition
Language (DDL), Data Manipulation Language (DML) and Data Control Language
(DCL). DDL deals with schema modifications; DML deals with content modifications;
DCL deals with user access and privilege modifications. If the application program is
written in C/C++, it shall use ODBC drivers to connect to the DBMS, or if it is written in
Java, it shall use JDBC drivers to connect to DBMS. Some vendors provide language
specific proprietary interfaces. For example MySQL provides drivers for PHP, Python,
etc.
These drivers are built on top of SQL. They provide methods to prepare statements,
execute statements, fetch results, etc.
Compiler – builds a data structure from the SQL statement and then does semantic
checking on the query such as whether the table exists, field exists, etc.
Optimizer – transforms the initial query plan (data structure created by compiler), into
sequence of operations usually pipelined together to achieve fast execution. It refers the
metadata (dictionary) and statistical information stored about the data to decide which
sequence of operations is likely to be faster and based on that it creates the optimal query
plan. Both cost and rule based optimizers are used in case of DRDBs.
Execution Engine – executes each step in the query plan chosen by optimizer. It
interacts with the relational engine to retrieve and store records.
Atomicity: Either all or none of the effect should appear in database after transaction
completes.
Durability: Once the transaction completes, effect of the transaction on the database
must never be lost.
All the above properties are explained in detail under the Transaction Chapter.
Recovery Manager- responsible for recovering the database from the disk image and
redo log files. Most of the databases uses a technique called ‘shadow paging’ to maintain
consistent image of memory in disk.
Field – abstracts column level information including type, length, etc Catalog – maintains
Meta data information about the relational database objects such as table, index, trigger,
field, etc
Table – responsible for insert, update, delete, fetch, execute. It interacts with the allocator
subsystem of storage engine, which in turn talks to buffer manager to get the job done.
Index – responsible for insert, update, delete, and scan of index nodes for all index types.
Popular index types are hash and tree. Hash index is used for improving the point lookup
(predicate with equality on primary key) and tree index is used for improving the range
query (predicate with greater or less than operator on key).
Expression Engine – represents the predicate (WHERE clause of SQL statement) of the
data retrieval operation and responsible for evaluating the expressions, which shall
include arithmetic, comparison, and logical expressions.
Buffer manager – responsible for loading pages from disk to memory and to manage the
buffer pool based on Least Recently Used (LRU) algorithm. This also has special purpose
allocator for storing control information, which are transient. Buffer pool is the memory
space used by buffer manager to cache disk pages associated with records, index
information, Meta data information. Some database systems have space limit at
individual level and some at global level for buffer pool size.
File Manager – Database in DRDB is nothing but a physical file at disk. File manager
maps disk pages of the file to the memory pages and does the actual disk I/O operations
in case of major faults generated by buffer manager module.