Sunteți pe pagina 1din 52

Database System Concepts and Architecture


Architecture of DBMS
Basic client/server DBMS architecture A client module will run on a user workstation or personal computer. Client module handles user interaction and provides the user-friendly interfaces such as forms- or menubased GUls (Graphical User Interfaces). The other kind of module, called a Server module, typically handles data storage, access, search, and other functions. Types - 2 tier and 3 tier architecture

Distribute components of an application between a client and a server A database can reside on a server machine (for example a UNIX box or mainframe), A user interface can reside on a client machine (a desktop PC), and The business logic can reside in either or both components.

If Client has
database access functionality (such as embedded database queries) and business logic

Any changes to the business logic, database access, or even the database often requires a new client component to be deployed for all users of the application. Effects of such changes would break earlier versions of the client component, resulting in a fragile system.




Front End is the content rendered by the browser. The content may be static or generated dynamically. A middle dynamic content processing and generation level application server, for example Ruby on Rails, Java EE, ASP.NET, PHP, ColdFusion platform. A back-end database, comprising both data sets and the database management system or RDBMS software that manages and provides access to the data.

Advantages of 3 -tier
Scale up at application layer and database layer is possible Supports large number of users Processing speed is high

Data model - The structure of a database By structure of a database, we mean the data types, relationships, and constraints that should hold for the data. Most data models also include a set of basic operations for specifying retrievals and updates on the database.

Categories of data models

Conceptual (high-level, semantic) data models: Provide concepts that are close to the way many users perceive data. (Also called entity-based or object-based data models.) Physical (low-level, internal) data models: Provide concepts that describe details of how data is stored in the computer. Implementation (representational) data models: Provide concepts that fall between the above two, balancing user views with some computer storage details.


logical model

Physical model

Conceptual data models use concepts such as

entities, attributes, and relationships.

An entity represents a real-world object or concept, such as an employee or a project, that is described in the database. An attribute represents some property of interest that further describes an entity, such as the employee's name or salary. A relationship among two or more entities represents an association among two or more entities, for example, a works-on relationship between an employee and a project

Representational (or implementation) data models concepts that may be understood by end users but that are not too far removed from the way data is organized within the computer. Types: Legacy data models - the network and hierarchical models Relational Model

Representational data models represent data by using record structures and hence are sometimes called record-based data models. Object data models a new family of higher-level implementation data models that are closer to conceptual data models. 3 types Hierachial,Network,Relational Model

Hierarchical Model Different records are inter-related through hierarchical or tree-like structures. A parent record can have several children, but a child can have only one parent NETWORK MODEL Child can have more than one parent record. Uses linked list for implementation The advantage of the network database is its ability to establish relationships between different branches of data records and thus offer increased access capability for the

Data record relationships must be predefined prior to the use of the database and must be redefined if records are a d d e d o r u p d a t e d .

Relational Model
The relational database relates or connects data in different files through the use of a key field, or common data element and not physical links or pointers Data elements are stored in different tables or files made up of rows and columns. In database terminology, tables are called "relations", rows are called "tuples" and columns are called "attributes"

Advantage of a relational database

Manager does not have to be aware of any data structure or data pointer. Unlike the other two type of DBMS, there is no need to traverse pointers in the Relational DBMS. This makes querying much more easier Exercise-convert above model into relational Model

Physical data models describe how data is stored as files in the computer by representing information such as record formats, record orderings, and access paths. An access path is a structure that makes the search for particular database records efficient.( indexed access method to a file)

The description of a database is called the database schema, which is specified during database design and is not expected to change frequentlv. Diagram displays the structure of each record type but not the actual instances of records - Schema Diagram Each object in the schema -such as STUDENT or COURSEa schema construct

Schema diagram
Figure 2.1 shows neither the data type of each data item nor the relationships among the various files. Many types of constraints are not represented in schema diagrams.

Instance & Database state

The data in the database at a particular moment in time is called a database state or snapshot. It is also called the current set of occurrences or instances in the database Every time we insert or delete a record or change the value of a data item in a record, we change one state of the database into another state.

THREE-SCHEMA ARCHITECTURE & DATA INDEPENDENCE Three important characteristics of the database approach, (1) Insulation of program-data (every program in every department has to specify which data fields they are going to process. If a field is changed, every program accessing that field must be altered to recognize the new format.) and program-operation independence (2) Support of multiple user views and (3) Use of a catalog to store the database description (schema).

3-schema archi
goal of the three-schema architectureis to separate the user applications and the physical database

Achieved by-3 level Architecture of DBMS

part of the database (view) representational data model (After Normalizaition)

structure of whole DB
representational data model (After Normalizaition)

Physical data model

Here schemas can be defined at the following three levels: 1. The internal level has an internal schema, which describes the physical storage structure of the database. The internal schema uses a physical data model and describes the complete details of data storage and access paths for the database.

The Three-Schema Architecture

2. The conceptual level has a conceptual schema, which describes the structure of the whole database for a community of users. The conceptual schema hides the details of physical storage structures and concentrates on describing entities, data types, relationships, user operations, and constraints. A representational data model is used to describe the conceptual schema often based on a conceptual schema design in a high-level data model.

3. The external or view level includes a number of external schemas or user views. Each external schema describes the part of the database that a particular user group is interested in and hides the rest of the database from that user group. Each external schema is typically implemented using a representational data model, possibly based on an external schema design in a high level data model.

three schemas are only descriptions of data; the only data that actually exists is at the physical level. In a DBMS based on the three-schema architecture, each user group refers only to its own external schema. Hence, the DBMS must transform a request specified on an external schema into a request against the conceptual schema, and then into a request on the internal schema for processing over the stored database.

If the request is a database retrieval, the data extracted from the stored database must be reformatted to match the user's external view. The processes of transforming requests and results between levels are called mappings

Benefits of Three Schema Architecture

Logical data independence - the capacity to change the conceptual schema without having to change external schema or application prgms ex: Employee (E#, Name, Address, Salary) A view including only E# and Name is not affected by changes in any other attributes.

Physical data independence - the capacity to change the internal schema without having to change the conceptual (or external) schema - internal schema may change to improve the performance (e.g., creating additional access structure) - easier to achieve logical data independence, because application programs are dependent on logical structure

DBMS Languages
The first step to create a database through DBMS is to specify conceptual and internal schemas for the database Data Definition Language (DDL): is used by database designers to define schemas Data Manipulation Language (DML) View Definition Language (VDL): is to specify user views

In current DBMS, the preceding types of languages are usually not considered distinct languages

Software Components of a DBMS

DBMS Component Modules Database System Utilities Tools Application Environments Communication Facilities


Typical DBMS Component Modules

DBMS Component Modules (2/2)

Disk access control

Access to the disk is controlled primarily by operating system (OS), which schedules disk input/output
Stored Data Manager-

Controls access to information that is stored on disk (database or the catalog Use basic os services for carrying out low level data transfer between the disk and computer main storage Once the data is in main memory buffers, it can be processed by other DBMS modules, as 39 well as by application programs

Buffer Manager Module buffering of disk pages.

Compilers DDL Compiler
processes schema definitions, specified in the DDL, and stores descriptions of the schemas (meta-data) in the DBMS catalog

The catalog includes information such as the

names and sizes of files, names and data types of data items,

storage details of each file, mapping information among schemas, and constraints in addition to many other types of information that are needed by the DBMS modules. DBMS software modules then look up the catalog information as needed

Handling DB access at runtime Runtime database processor

database accesses at runtime; it receives retrieval or update operations and carries them out on the database Access to disk goes through the stored data manager, and the buffer manager keeps track of the database pages in memory

Query Compiler high-level queries that are entered interactively. It parses, analyzes, and compiles or interprets a query by creating database access code, and then generates calls to the runtime processor for executing the code. DML Compiler & Precompiler/Host language compiler

precompiler extracts DML commands from an application program written in a host programming language. These commands are sent to the DML compiler for compilation into object code for database access. The rest of the program is sent to the host language compiler
The object codes for the DML commands and the rest of the

program are linked, forming a canned transaction whose executable code includes calls to the

Database System Utilities

Loading: load/transfer using files
Conversion tools

Backup: copy/dump databases

Failure recovery Incremental backups

File reorganization: to improve performance Performance/access Monitoring Sorting/data compression/interfacing to network


CASE: Computer Aided Software Engineering Tools
DB designers/DBA/users Used in Design phase

Information repository
Data dictionary (data repository) systems Stores Catalog/design decisions/usage standards/application program descriptions/user information

Application Development Environments

E.g. PowerBuilder/JBuilder Supports
Development of database applications Database design GUI development Querying and updating


Communication Software
Provide access for remote users DB/DC package integrated DBMS and data communications system Supports for distributed DBMSs


DBMS Classifications


DBMS Classification Based on Data Model

Relational data model Object data model Object-relational data model Extended-relational model XML Model

Hierarchical data model Network data model


DBMS Classification Based on Number of Users

Single-user systems Multi-user systems


DBMS Classification Based on Number of Sites

Centralized systems Distributed DBMSs (DDBMS)
Homogeneous DDBMS
use the same DBMS software at multiple sites

Heterogeneous DBMS (Federated DBMS/multi-database systems)

DBMSs are loosely coupled and have a degree of local autonomy

DBMS Classification More Criteria

Cost Type of access path Purpose
General purpose Special purpose
E.g. Airline system (OLTP Online transaction processing systems)


Data Models Database Schemas DB Languages DBMS Interfaces DB System Environment DBMS Architectures DBMS Classifications