A database is a collection of related data. The data stored can be a few entries, or rows, that make up a simple address book of names, addresses, and phone numbers. In contrast, the database can also contain millions of records that describe the catalog, purchases, orders, and payroll of a large company. The database behind our case study, Alexa and Dave's Online Wines, is an example of a medium-sized database that falls between these two extremes.
A DBMS is a set of components for defining, constructing, and manipulating a database. When we refer to a database management system, we generally mean a relational DBMS or RDBMS. Relational databases store and manage relationships between data-for example, customers placing orders, customer orders containing line items, or wineries being part of a wine-growing region.
Figure 1-4 shows the simplified architecture of a typical DBMS.
Figure 1-4. The architecture of a typical DBMS
A DBMS consists of several components:
- Applications interface
-
Libraries for communicating with the DBMS. Most DBMSs have a simple command-line interpreter that often uses these libraries to relay requests typed from the keyboard to the DBMS and to display responses. In a web database application, the command-line interpreter is usually replaced by a function library that is part of the middle-tier scripting language.
- SQL interpreter
-
A parser that checks the syntax of incoming query statements and translates these into an internal representation.
- Query evaluator
-
Generates different plans for evaluating a query by considering database statistics and properties, selects one of these plans, and translates the plan into low-level actions that are executed.
- Data access
-
The modules that manage access to the data stored on disk, including a transaction manager, a recovery manager, the main-memory buffer manager, data security manager, and the file and access method manager.
- Database
-
The physical data itself stored in data files. The data also contains index files for fast access to data, and database and system summary statistics primarily used for query plan generation and optimization.
The important components for web database application developers are the database and applications interface. For all but large-scale applications, understanding and configuring the other components of a DBMS is usually unnecessary.