RDBMS Architecture
Introduction
RDBMS stands for Relational Database Management System. An RDBMS is software that stores and manages relational data while providing mechanisms for SQL processing, data storage, transactions, security, concurrency, indexing, recovery, and data integrity. Examples include MySQL, PostgreSQL, Oracle Database, Microsoft SQL Server, MariaDB, and many other systems that organize data into relational structures and allow users or applications to work with that data using SQL.
At a beginner level, it is tempting to think of an RDBMS as a simple system where SQL directly touches a table. The real architecture is much richer. When an application sends a query, the database server accepts a connection, authenticates the user, creates or uses a session, parses SQL syntax, validates table and column references, checks permissions, rewrites parts of the query when needed, chooses an execution plan, reads data through a storage engine, uses memory caches and indexes, coordinates transactions, handles concurrent users, records recovery information, and finally returns the result.
This architecture matters because SQL performance, correctness, security, and reliability depend on many internal components. A slow query may be caused by a missing index, stale statistics, poor join order, insufficient memory, lock waiting, or inefficient application access. A failed update may be caused by a constraint, permission issue, deadlock, or transaction rollback. A database can recover after a crash because it uses logs, checkpoints, and recovery mechanisms. Understanding architecture gives SQL learners a deeper view of what happens after a statement is sent to the database.
This tutorial explains RDBMS architecture in a practical way. It covers the client layer, connection layer, database sessions, SQL processing, parsing, semantic validation, query rewriting, optimization, execution plans, execution engine, storage engine, logical and physical storage, pages and blocks, buffer cache, indexes, transaction management, ACID properties, concurrency control, locks, MVCC, deadlocks, recovery, transaction logs, write-ahead logging, checkpoints, security, metadata, background processes, memory architecture, storage architecture, three-schema architecture, and the complete flow of SELECT and UPDATE statements.
Basic RDBMS Architecture
A simplified RDBMS architecture can be viewed as several layers. The client or application layer sends SQL statements. The connection layer manages network communication, authentication, and sessions. The SQL processing layer understands and plans the statement. The transaction and concurrency layer coordinates correctness when multiple users are working at the same time. The storage engine reads and writes data. Memory and persistent storage hold cached pages, indexes, data files, logs, and metadata.
Client / Application
|
Connection Layer
|
SQL Processing Layer
|
Transaction & Concurrency Layer
|
Storage Engine
|
Memory + Persistent Storage
Different RDBMS products use different component names and internal designs, but the broad responsibilities are similar. PostgreSQL, MySQL, Oracle, and SQL Server do not have identical architectures, yet they all need to accept client requests, process SQL, manage transactions, access storage, enforce security, and recover from failures. The names may change, but the problem being solved is common.
Client and Application Layer
The client is the system that communicates with the RDBMS. It may be a Java application, Python application, web backend, mobile backend, database GUI, command-line client, reporting tool, ETL job, BI dashboard, or admin script. The client sends SQL statements and receives results. In a typical web application, the browser does not directly connect to the database. The backend application connects to the RDBMS using a driver.
Java Application
|
JDBC
|
PostgreSQL
For example, a Java backend can use JDBC to send SQL to PostgreSQL. A Python service can use a database driver to communicate with MySQL. A reporting tool can connect to SQL Server and run analytical queries. The RDBMS architecture begins at this boundary: the point where a client requests database work.
The client may send simple statements such as SELECT * FROM customers, parameterized queries, prepared statements, transaction commands, stored procedure calls, or administrative commands. The database must process each request according to permissions, syntax, schema, transaction state, and current workload.
Example Client Request
Suppose an application needs customer information. It sends a SQL query to the database:
SELECT customer_id,
name,
email
FROM customers
WHERE customer_id = 101;
Conceptually, the application sends a SQL query, the RDBMS processes it, the database returns the matching record, and the application receives the result. This looks simple from the outside, but internally many components participate. The query must be accepted through a connection, associated with a session, parsed, validated, optimized, executed, and returned.
Application
|
SQL Query
|
RDBMS
|
Database
|
Result
|
Application
This is why the same SQL query can perform differently in different environments. One database may have an index, another may not. One database may have accurate statistics, another may not. One query may wait because another transaction holds a lock. One connection may fail because authentication or permissions are incorrect. RDBMS architecture explains these behaviors.
Connection Layer
Before executing SQL, the client normally establishes a connection with the database server. The connection layer handles client connections, network communication, authentication, session creation, connection state, and sometimes protocol-level features such as SSL, prepared statement handling, and connection parameters. Without a connection, the client cannot send SQL statements to the database server.
Client
|
Connection Request
|
Authentication
|
Database Session
|
SQL Execution
The connection layer is important for both security and performance. If authentication fails, the query never reaches execution. If too many connections are opened, the database may become overloaded. If network latency is high, query response time may suffer even when the query itself is efficient. If the application does not close connections properly, connection pool exhaustion can occur.
Modern applications often use connection pools to reuse database connections. The RDBMS must support many client sessions at once while controlling resources. This is one reason database servers are more complex than simple file storage.
Database Session
After a connection is established, the RDBMS creates or manages a session for the client. A session represents the client's active interaction with the database. It may contain information such as the authenticated user, current database, current schema, transaction state, session settings, temporary objects, prepared statements, locks held, and resource usage.
Application A -> Session 1
Application B -> Session 2
Application C -> Session 3
Many sessions can operate concurrently. One user may be reading customer data, another may be updating an order, another may be running a report, and another may be inserting audit records. The RDBMS must isolate these sessions appropriately according to transaction rules and permissions.
Session state can affect query behavior. A transaction may be open in one session. A temporary table may exist only for one session. A setting may control date format, isolation level, search path, or timeout behavior. Understanding sessions helps explain why the same SQL statement may behave differently under different connection settings.
SQL Processing Layer
The SQL processing layer is responsible for understanding and executing SQL statements. When the database receives a query such as SELECT name, salary FROM employees WHERE department = 'IT', it does not blindly scan a table immediately. It follows a processing pipeline. A simplified pipeline includes parsing, semantic validation, query rewriting, optimization, execution plan generation, and execution.
SQL Query
|
Parser
|
Semantic Validation
|
Query Rewriting
|
Optimizer
|
Execution Plan
|
Execution Engine
Exact stages and names differ between RDBMS products. Some systems have separate parser, analyzer, rewriter, planner, optimizer, and executor components. Others combine responsibilities. The important point is that SQL processing transforms text into an executable plan. The database does not simply read SQL as plain text line by line.
SQL Parser
The parser examines SQL syntax. It checks whether the statement follows the grammar rules understood by the database. For example, SELECT name FROM employees is syntactically valid. But SELEC name FROM employees contains invalid syntax because SELECT is misspelled. The parser detects this problem before any table data is accessed.
Parsing converts the SQL text into an internal representation that later components can analyze. Conceptually, this query:
SELECT name
FROM employees
WHERE salary > 50000
can be represented internally as a tree-like structure containing the selected column, source table, and condition. This internal representation makes it possible for the database to validate objects, rewrite expressions, optimize access paths, and execute the query.
SELECT
|
+-- Column: name
+-- Table: employees
+-- Condition
|
+-- salary
+-- >
+-- 50000
SQL learners usually do not need to build parser trees themselves, but understanding parsing helps explain syntax errors. If a query fails before checking whether a table exists, the parser may have rejected the statement. If the syntax is valid but a column does not exist, the query reaches semantic validation and fails there.
Semantic Validation
A query can be syntactically correct but still invalid. For example, SELECT unknown_column FROM employees uses valid SQL syntax, but it fails if the employees table does not contain a column named unknown_column. Semantic validation checks meaning, not just grammar.
The RDBMS may validate table existence, column existence, data types, function names, aggregate usage, grouping rules, object references, and permissions. If the user does not have access to the table, the query should fail. If a function is used with the wrong argument type, the query may fail. If a column is referenced ambiguously in a join, the database may ask for qualification.
Semantic validation protects correctness before execution begins. It prevents the database from attempting a plan for a query that does not make sense against the schema, user permissions, or data types. For developers and testers, validation errors are useful signals. They tell you whether the issue is syntax, schema, permissions, or logic.
Query Rewriter
Some RDBMS systems transform or rewrite queries before optimization. Query rewriting can expand views into their underlying definitions, simplify expressions, remove unnecessary parts, apply rules, transform subqueries, or prepare the logical query representation for optimization. The rewritten query should be logically equivalent to the original request.
Original SQL
|
Logical Transformation
|
Equivalent Query Representation
For example, if a query selects from a view, the database may replace the view reference with the query definition behind that view. If a condition can be simplified, the rewriter may simplify it. If rules or database-specific transformations apply, they may happen before the optimizer estimates execution strategies.
The exact rewriting mechanisms are database-specific. Beginners do not need to memorize every internal transformation, but they should understand that the SQL you write may be converted into a different but equivalent internal form before execution.
Query Optimizer
The query optimizer is one of the most important RDBMS components. It decides how the database should execute a query. A single SQL query can often be executed in multiple ways. The optimizer estimates the cost of possible strategies and chooses an execution plan that it believes will be efficient.
Consider this query:
SELECT *
FROM customers
WHERE email = 'john@example.com';
The database could scan the entire customers table row by row, or it could use an index on email if one exists. If the table has five million rows, an index lookup may be much faster. If the table has only a few rows, a simple scan may be acceptable. The optimizer uses available information to choose.
Option 1: Table Scan
Customer Row 1
Customer Row 2
Customer Row 3
...
Option 2: Index Lookup
Email Index
|
Matching Location
|
Customer Record
The optimizer may consider available indexes, table sizes, statistics, data distribution, join order, join algorithms, filtering conditions, estimated number of rows, sorting requirements, grouping requirements, and cost estimates. Performance work often begins with understanding what the optimizer chose and why.
Execution Plan
The optimizer produces an execution plan. An execution plan is the database's chosen strategy for running a SQL statement. A simple plan might use an index lookup on customers.email and then return the matching row. A join plan might scan one table, use an index on another table, join matching rows, filter results, sort output, and return final records.
SELECT
|
Index Lookup
|
customers.email
|
Return Matching Row
Execution plans are extremely important when diagnosing slow SQL queries. They reveal whether the database is using indexes, scanning tables, joining in an efficient order, sorting large datasets, performing nested loops, hashing joins, or reading many more rows than expected. A query that looks short can have an expensive execution plan.
Developers and database engineers use commands such as EXPLAIN or database-specific plan tools to inspect execution plans. Testers and performance engineers may also use plans during investigation. Understanding execution plans turns SQL performance tuning from guesswork into evidence-based work.
Query Execution Engine
After an execution plan is selected, the execution engine performs the required operations. These operations may include table scans, index scans, index seeks or lookups, filters, joins, sorts, aggregations, grouping, limit operations, inserts, updates, deletes, and result formatting. The execution engine follows the plan produced by the optimizer.
For example, this query requires grouping and counting:
SELECT department,
COUNT(*)
FROM employees
GROUP BY department;
The execution engine reads rows, groups them by department, counts rows in each group, and returns the result. Depending on indexes, memory, and optimizer decisions, the database may use different physical operations to produce the same logical result.
The execution engine works closely with the storage engine, transaction manager, buffer manager, and concurrency components. If data pages are not in memory, they may need to be read from storage. If another transaction holds a conflicting lock, execution may wait. If a query modifies data, recovery information may need to be generated. Execution is where many architecture components meet.
Storage Engine
The storage engine manages how database information is physically or logically stored and accessed. Its responsibilities can include reading pages, writing pages, managing indexes, buffer management, record storage, transaction integration, disk I/O, and sometimes table-specific storage formats. Implementation details vary significantly across RDBMS products.
SQL Execution Engine
|
Storage Engine
|
Memory / Cache
|
Persistent Storage
In some systems, the storage engine is pluggable or has multiple implementations. In others, storage behavior is tightly integrated with the database engine. MySQL, for example, is known for storage engines such as InnoDB. PostgreSQL uses its own integrated storage architecture. Oracle and SQL Server have their own internal storage designs.
For SQL learners, the key idea is that tables and indexes are not abstract ideas floating in memory. They are stored using internal structures. The storage engine knows how to locate records, read data pages, maintain indexes, write changes, and coordinate with recovery and transaction systems.
Logical Storage vs Physical Storage
Users normally interact with logical database objects such as databases, schemas, tables, rows, and columns. A SQL query says SELECT * FROM customers. The user does not specify which disk file, which page number, or which byte offset contains the matching row. The RDBMS maps logical objects to lower-level storage structures.
Logical View:
Customers Table
|
Rows
Physical/Internal View:
Pages / Blocks
|
Files / Storage
This separation is important. Applications can use SQL without knowing the exact physical layout of records. The database can create indexes, move pages, update statistics, change storage allocation, and manage files internally while the logical SQL interface remains stable.
Physical storage still affects performance. If data is fragmented, if indexes are missing, if storage is slow, or if the working set does not fit in memory, query performance may suffer. But SQL users interact primarily with logical objects while the RDBMS handles the mapping to physical storage.
Pages and Blocks
RDBMS systems usually read and write data in units such as pages or blocks rather than reading individual bytes from storage for every query. A page can contain rows, index entries, metadata, or other internal database information. Exact page sizes and structures depend on the database product.
Database File
|
+-- Page 1
+-- Page 2
+-- Page 3
+-- Page 4
+-- Page 5
Reading and writing in pages is more efficient than handling every field independently at the storage level. When a query needs a row, the database may load the page containing that row into memory. If related rows are stored nearby, they may already be available. If many pages must be read from disk, the query may become slower.
Pages and blocks explain why indexes, clustering, table size, and access patterns matter. A query that reads a few indexed pages is usually cheaper than one that scans thousands of pages. Storage-level architecture is hidden from ordinary SQL, but it strongly affects performance.
Buffer Cache
Reading from persistent storage is relatively expensive compared with reading from memory. Therefore, RDBMS systems use memory to cache frequently accessed database pages. This memory area is commonly called a buffer cache or buffer pool, depending on the database. When a query needs a page, the database first checks whether that page is already in memory.
SQL Query
|
Need Data Page
|
Is Page in Memory?
|
+-- Yes -> Use Cached Page
|
+-- No -> Read from Storage
|
v
Cache Page
If frequently accessed pages remain in memory, performance can improve significantly. Repeated queries for the same products, accounts, or indexes may avoid disk reads. This is why database memory configuration matters. A database with insufficient memory may perform excessive storage I/O, even if queries are logically correct.
The buffer cache must also handle modified pages. When data changes, pages in memory may become dirty, meaning they contain changes not yet fully written to persistent data files. Background processes and checkpoints help coordinate when dirty pages are written safely.
Index Management
Indexes are additional data structures that help the database locate information efficiently. Without an appropriate index, the database may need to scan many rows to find matches. With an appropriate index, it can locate matching entries more quickly. Indexes are especially important for frequently filtered, joined, sorted, or uniquely constrained columns.
CREATE INDEX idx_customer_email
ON customers(email);
After this index is created, a query searching by email may become faster:
SELECT *
FROM customers
WHERE email = ?;
The storage engine maintains indexes as data changes. This is why indexes have both benefits and costs. They can speed up reads but consume storage and add work during inserts, updates, and deletes. The optimizer decides whether an index is useful for a particular query. Index architecture is a major part of RDBMS performance.
Transaction Manager
The transaction manager coordinates database transactions. A transaction is a group of operations that should succeed or fail as one unit. In a bank transfer, money deducted from one account must be added to another account. Both changes should commit together, or both should roll back together.
BEGIN;
UPDATE accounts
SET balance = balance - 500
WHERE account_id = 101;
UPDATE accounts
SET balance = balance + 500
WHERE account_id = 102;
COMMIT;
The transaction manager helps ensure that operations follow the database's transactional guarantees. It tracks transaction state, coordinates commit and rollback, works with logs for durability, and interacts with concurrency control mechanisms. If an error occurs before completion, the transaction can roll back and restore the appropriate state.
Transactions are one of the reasons RDBMS systems are trusted for critical business applications. They protect workflows where partial success would be dangerous, such as payments, reservations, inventory updates, payroll, and financial transfers.
ACID Properties
RDBMS transaction architecture is commonly associated with ACID: Atomicity, Consistency, Isolation, and Durability. Atomicity means all operations in a transaction succeed as a unit or the transaction is rolled back. Consistency means transactions move the database between states that satisfy defined integrity rules. Isolation means concurrent transactions are controlled according to configured isolation semantics. Durability means committed changes survive failures according to the RDBMS recovery mechanisms.
ACID properties are not just interview theory. They explain why a payment should not be half-recorded, why constraints should remain valid, why concurrent users should not corrupt each other's changes, and why committed data should not disappear after a crash. The transaction manager, concurrency components, storage engine, and recovery manager work together to support these guarantees.
Different databases and isolation levels may provide different behavior in edge cases. For example, some isolation levels allow more concurrency but expose certain phenomena such as non-repeatable reads or phantom reads. Understanding ACID helps developers choose transaction boundaries and isolation settings responsibly.
Concurrency Control
Many users may access the same database simultaneously. User A may update account 101. User B may also try to update account 101. User C may read account 101 while another transaction is active. The RDBMS must coordinate these operations correctly so data remains valid and users get predictable behavior.
Concurrency mechanisms may include locks, isolation levels, Multi-Version Concurrency Control, latches, internal synchronization, and transaction timestamps. The implementation varies by database. Some systems rely heavily on locking. Others use MVCC to allow readers and writers to proceed with less blocking in common cases.
Concurrency control is essential because real applications are multi-user. Without it, two users could overwrite each other's changes, reports could read inconsistent data, and transactions could interfere unpredictably. The database must balance correctness and performance.
Lock Manager
Some operations require locks. A lock is a control mechanism that prevents conflicting operations from corrupting data. If Transaction A updates row 101, it may acquire a lock. If Transaction B wants conflicting access to the same row, it may need to wait or fail depending on the database rules and timeout settings.
Transaction A
|
Update Row 101
|
Acquire Lock
|
Modify Data
|
Commit
|
Release Lock
Locking helps protect concurrent operations, but it can also affect performance. Long transactions may hold locks for too long. Reports may block updates depending on isolation and database behavior. Poor transaction design can create lock contention. Understanding locks helps diagnose application slowdowns and timeout errors.
MVCC
Many modern relational database systems use Multi-Version Concurrency Control, or MVCC, in some form. Instead of every reader always blocking writers, the database can maintain multiple logical versions of data. A reader may see an older committed version while a writer creates a newer version. This can improve concurrency by allowing certain reads and writes to proceed without blocking each other.
Old Version
^
Reader
Current/New Version
^
Writer
PostgreSQL is a prominent example of an MVCC-based system. Other databases use their own approaches and terminology. MVCC helps explain why some databases can provide strong read consistency while reducing lock waits for ordinary reads.
MVCC also introduces maintenance considerations. Old row versions may need cleanup. Long-running transactions can prevent cleanup and affect storage. Database internals differ, but the core idea is that versioning can improve concurrency while requiring careful management.
Deadlocks
A deadlock can occur when transactions wait on each other's resources in a cycle. For example, Transaction A holds Row 1 and waits for Row 2. Transaction B holds Row 2 and waits for Row 1. Neither can proceed because each is waiting for the other.
Transaction A holds Row 1 and waits for Row 2
Transaction B holds Row 2 and waits for Row 1
A waits for B
^ |
| v
B waits for A
RDBMS systems typically detect deadlocks and abort one transaction so the other can proceed. The aborted transaction receives an error and may need to be retried by the application. Deadlocks are not always signs of a broken database; they can happen in concurrent systems when transactions acquire resources in conflicting orders.
Developers can reduce deadlocks by keeping transactions short, accessing tables and rows in consistent order, using appropriate indexes, avoiding unnecessary locks, and designing retry logic for safe operations. Testers may encounter deadlocks during load testing or concurrent scenario execution.
Recovery Manager
The recovery subsystem helps restore database consistency after failures. Failures may include database crash, server crash, power failure, operating system failure, storage problem, or process termination. The RDBMS uses recovery mechanisms such as transaction logs, checkpoints, and redo or undo operations depending on the database design.
Recovery is a major reason databases are more reliable than ordinary file writes. If a crash happens during an update, the database should be able to determine which changes were committed, which were not, and how to restore a consistent state. The recovery manager works with transaction logs and storage structures to achieve this.
For users, recovery is mostly invisible when it works correctly. After restart, the database may perform crash recovery and then become available. For administrators and engineers, recovery behavior is critical for durability, backup strategy, disaster recovery, and production reliability.
Transaction Log and Write-Ahead Logging
Database modifications are typically recorded in a transaction log or equivalent recovery structure. The log records enough information for the database to recover committed changes and handle incomplete transactions. Many RDBMS systems use some form of write-ahead logging. The core idea is that relevant log information must reach durable storage before the corresponding modified data page is considered safely written.
Transaction
|
Log Changes
|
Modify Database Pages
|
Commit
Write-ahead logging helps support crash recovery and durability. If the database crashes after a commit is acknowledged, the log can help redo committed changes. If the database crashes before a transaction completes, the log can help undo or ignore incomplete work depending on the recovery design.
Exact log formats and protocols differ across database systems. SQL learners do not need to memorize every storage detail, but they should understand that durability is not magic. It is implemented through careful logging, flushing, checkpoints, and recovery processing.
Checkpoints
Databases periodically perform operations called checkpoints. A checkpoint helps establish a known recovery position and coordinate dirty pages with transaction log state. After a crash, checkpoints can reduce the amount of recovery work required because the database knows that certain changes were already written safely to data files.
Transaction Log
--------------------------------
^
Checkpoint
Checkpoint behavior differs between RDBMS products. Some checkpoints may write dirty pages. Some coordinate log positions. Some are triggered by time, log volume, manual commands, or database activity. The practical importance is that checkpoints help manage the relationship between memory, logs, and persistent storage.
Checkpoints can also affect performance. Heavy checkpoint activity may increase I/O. Poor configuration may cause write spikes. Database administrators tune checkpoint behavior based on workload and system requirements.
Security Manager
The RDBMS also manages database security. It answers questions such as: who is the user, can the user connect, can the user access this database, can the user select this table, can the user update this table, and can the user drop this table? Security is enforced through authentication and authorization.
Authentication determines identity. It asks, "Who are you?" A user may provide a username and credential, or the database may integrate with external authentication systems depending on deployment. After authentication succeeds, the database creates a session for that user.
Authorization determines permission. It asks, "What are you allowed to do?" For example:
GRANT SELECT
ON employees
TO analyst_user;
This grants read access on the employees table to analyst_user. The user may be allowed to read the table without being allowed to insert, update, delete, or drop it. Proper authorization protects sensitive data and prevents accidental or malicious changes.
Metadata and System Catalog
The RDBMS needs information about its own database objects. This information is called metadata. Metadata includes table names, column names, data types, constraints, indexes, views, users, permissions, statistics, functions, schemas, and other internal details. The database stores this information in a system catalog, data dictionary, or similar internal structures.
Suppose a table is created like this:
CREATE TABLE employees (
employee_id INT PRIMARY KEY,
name VARCHAR(100),
salary DECIMAL(10, 2)
);
The RDBMS stores metadata describing the employees table, the employee_id column, the name column, the salary column, the primary key, and data types. This metadata helps semantic validation, query optimization, permissions, administration tools, and schema inspection.
When a user runs a query, the database consults metadata to know whether tables and columns exist. When the optimizer estimates cost, it uses statistics stored as metadata. When a tool displays table definitions, it reads metadata. The system catalog is therefore central to RDBMS operation.
Background Processes
Database servers often run background processes or threads that perform maintenance activities. Depending on the RDBMS, these may handle writing dirty pages, checkpoints, log processing, cleanup, statistics, recovery, replication, vacuuming, garbage collection, monitoring, and other internal work. The names and architecture differ substantially across database products.
Database Server
|
+-- Client Sessions
+-- Query Processing
+-- Background Writer
+-- Checkpoint Processing
+-- Recovery Processing
+-- Maintenance Tasks
Background work is one reason database performance can change even when no obvious user query is running. A checkpoint may increase I/O. Statistics collection may run. Cleanup processes may reclaim storage. Replication may transmit logs. These processes help keep the database healthy and recoverable.
Understanding background processes is useful for operations and troubleshooting. A production issue may involve not only one query but also maintenance tasks, storage pressure, replication lag, checkpoint activity, or cleanup delays.
Complete SELECT Architecture
Consider a SELECT query:
SELECT name, salary
FROM employees
WHERE employee_id = 101;
A simplified lifecycle begins with the client sending the query through an existing connection. The session receives the statement. The parser checks syntax. Semantic validation confirms that the employees table and columns exist and that the user has permission. The optimizer chooses an execution plan, possibly using an index on employee_id. The execution engine follows the plan. The storage engine retrieves data pages from buffer cache or persistent storage. The result is returned to the client.
Client
|
Connection / Session
|
SQL Parser
|
Semantic Validation
|
Query Optimizer
|
Execution Plan
|
Execution Engine
|
Storage Engine
|
Buffer Cache
|
Index / Table Data
|
Result
|
Client
This flow shows why a simple SELECT can still involve many internal steps. If the parser fails, the query never reaches the optimizer. If permissions fail, execution stops. If the index is missing, the plan may scan the table. If the data page is not in memory, storage I/O may be needed. Each component contributes to the final result.
Complete UPDATE Architecture
An UPDATE statement involves additional responsibilities because it changes data. Consider this statement:
UPDATE accounts
SET balance = balance - 500
WHERE account_id = 101;
The statement is parsed, validated, optimized, and executed. The database must locate the target record, coordinate transaction state, handle concurrency control, generate recovery information, modify database pages, maintain indexes if needed, and process commit or rollback. If another transaction holds a conflicting lock, the update may wait. If a constraint is violated, it may fail. If a deadlock occurs, one transaction may be aborted.
UPDATE Statement
|
Parser
|
Optimizer
|
Execution Engine
|
Transaction Manager
|
Concurrency Control
|
Locate Record
|
Generate Recovery Information
|
Modify Database Page
|
COMMIT
|
Durability Processing
Updates demonstrate why transaction and recovery architecture matters. Reading data is important, but changing data safely is one of the biggest responsibilities of an RDBMS.
Memory Architecture
RDBMS systems use memory for many purposes. Memory may include buffer cache, query or plan cache, sort memory, hash memory, session memory, transaction structures, lock tables, metadata caches, and internal working areas. Different databases use different names and memory architectures.
RDBMS Memory
|
+-- Buffer Cache
+-- Query / Plan Cache
+-- Sort / Hash Memory
+-- Session Memory
+-- Transaction Structures
+-- Internal Metadata
Memory affects performance significantly. If useful pages are cached, queries can avoid storage I/O. If enough memory is available for sorting and hashing, operations may avoid spilling to disk. If session memory is exhausted, queries may fail or slow down. Database memory configuration must match workload and system capacity.
Persistent Storage Architecture
Persistent storage contains the durable database information. It may include data files, index data, transaction logs, temporary data, metadata, control files, configuration-related files, and backup-related structures. The physical organization differs across PostgreSQL, MySQL, Oracle, SQL Server, and other systems.
Database Storage
|
+-- Data Files
+-- Index Data
+-- Transaction Logs
+-- Temporary Data
+-- Metadata / Control Information
Persistent storage is where data survives restarts and failures. The RDBMS carefully coordinates memory and storage. Changes may be made in memory first, recorded in logs, and later written to data files. Recovery mechanisms use logs and storage state to restore consistency after failures.
Storage performance matters. Slow disks, saturated I/O, fragmented data, insufficient throughput, or expensive cloud storage choices can affect query latency. SQL performance is not only about syntax; it also depends on memory, storage, and internal architecture.
Three-Schema Architecture
Database architecture can also be studied using the classic three-schema architecture. It contains the external level, conceptual level, and internal level. This is different from the internal component architecture discussed earlier, but it is useful for understanding data independence.
External Level
|
Conceptual Level
|
Internal Level
The external level represents how different users or applications see data. An HR user may see employee name, department, and salary. A support user may see employee name and department but not salary. Different external views can hide or reshape underlying data for different needs.
The conceptual level describes the overall logical structure of the database. It includes entities such as employees, departments, projects, customers, orders, and products, along with their relationships. It describes what data exists and how it is logically related.
The internal level deals with how data is physically represented and accessed. It includes pages, files, indexes, record layout, storage structures, and physical access paths. Users normally do not interact directly with this level. The separation helps provide logical and physical data independence.
Logical and Physical Data Independence
Logical data independence refers to the ability to change aspects of the logical schema while minimizing effects on external views and applications. In practice, whether an application is affected depends heavily on the type of schema change and how the application accesses the database. Adding a new column may not affect existing queries, but renaming or removing a column can break them.
Physical data independence means storage-level changes can often occur without changing application SQL. For example, creating an index may change the physical access strategy, but the application query remains the same:
SELECT *
FROM customers
WHERE email = ?;
The application does not need to know exactly where the matching record is stored. The RDBMS can decide whether to use an index, scan a table, read from cache, or access storage. This separation is one of the benefits of using a database management system rather than direct file handling.
Major RDBMS Components
The following table summarizes major RDBMS components and responsibilities. Not every RDBMS uses exactly these component names or boundaries, but the responsibilities are common across relational database systems.
| Component | Responsibility |
|---|---|
| Connection Manager | Handles client connections and sessions |
| Parser | Analyzes SQL syntax |
| Validator | Checks objects, data types, and permissions |
| Query Rewriter | Applies logical transformations |
| Optimizer | Chooses execution strategy |
| Execution Engine | Executes the query plan |
| Storage Engine | Reads and writes stored data |
| Buffer Manager | Manages cached pages |
| Transaction Manager | Controls transactions |
| Concurrency Manager | Coordinates simultaneous access |
| Recovery Manager | Handles crash recovery |
| Security System | Handles authentication and authorization |
| System Catalog | Stores metadata |
Real-World RDBMS Architecture View
A more complete conceptual view starts with clients such as web applications, APIs, reporting tools, or command-line clients. Requests enter the connection layer. SQL moves through the processor, including parser, validator, rewriter, optimizer, and execution engine. Data-changing statements interact with transaction and concurrency systems. The storage engine accesses buffer cache, tables, indexes, logs, and persistent storage. Supporting components handle security, metadata, recovery, and background processing.
CLIENTS
Web / API / Application
|
Connection Layer
|
SQL Processor
Parser -> Validator -> Rewriter -> Optimizer -> Execution Engine
|
Transaction Layer
Transactions -> Locks / MVCC -> Concurrency
|
Storage Engine
Buffer Management -> Tables -> Indexes
|
Persistent Storage
Data -> Indexes -> Transaction Logs
This view is still simplified, but it is much more accurate than thinking SQL directly touches a table. An RDBMS is a complete data-management system sitting between applications and persistent relational data. It interprets and optimizes SQL, manages storage and memory, coordinates concurrent transactions, enforces security and integrity, and provides recovery mechanisms.
Interview-Ready Explanation
A short interview answer is: RDBMS architecture includes layers and components that accept client connections, process SQL, optimize queries, execute plans, manage storage, control transactions, handle concurrency, enforce security, maintain metadata, and recover from failures.
A stronger answer explains the flow. When a SQL query reaches the RDBMS, the connection layer manages the session. The parser checks syntax. Semantic validation checks tables, columns, types, and permissions. The optimizer chooses an execution plan based on indexes, statistics, table sizes, filters, and joins. The execution engine runs the plan using the storage engine, buffer cache, indexes, and data pages. For updates, the transaction manager, concurrency control, logs, and recovery mechanisms ensure correctness and durability.
You can also mention that different database products implement these components differently, but the responsibilities are common. RDBMS architecture is important for understanding query performance, locking, transactions, security, indexing, and crash recovery.
Key Takeaway
RDBMS architecture is much more than SQL to table. A more accurate picture is SQL request to connection, parser, validation, optimizer, execution plan, execution engine, transaction and concurrency control, storage engine, memory, indexes, data pages, and persistent storage. Supporting systems manage security, metadata, recovery, logging, checkpoints, and background maintenance.
An RDBMS is a complete data-management system that sits between applications and persistent relational data. It interprets and optimizes SQL, manages logical and physical storage, coordinates concurrent transactions, enforces integrity and permissions, maintains indexes, uses memory caches, records recovery information, and restores consistency after failures.
For SQL learners, understanding architecture turns database behavior into something explainable. Syntax errors come from parsing. Missing column errors come from validation. Slow queries often involve optimizer choices, indexes, statistics, memory, and storage. Blocking and deadlocks involve concurrency control. Reliable commits involve logs and recovery. Once these pieces are clear, SQL becomes easier to debug, tune, and explain in real-world interviews.