Вы находитесь на странице: 1из 39

Advanced DBMS

By
Liyakathunisa,
SJCE, Mysore
Prerequisites
• Data Structures
• Algorithm
• Any Programming Language
• Discrete Math etc.
• Starting from now …

Something completely different!


What is Database?
• Essentially, a database is a set of data, or
a collection of information. These data are
related.
• Examples:
Student Information
human genome sequence
company products information
More Examples
• Airline Reservation Systems
Reservations by a single customer on a single flight,
including such information as assigned seat or meal
preference
Information about the flight, the airports thy fly from
and to, the departure and arrival times, etc.
Ticket prices, requirements, and availability
• Banking Systems
Customers, accounts, loans and the balances
Deposit or withdraw money
What’s DBMS?
• DataBase Management System (DBMS)

A powerful tool for creating and manage large


amounts of data efficiently and allowing it to
persist over long periods of time, safely. It also
provides efficient accesses to multiple users.

It is used to manage databases.


DBMS capabilities
• Persistent Storage
• Programming Interface
• Transaction management
DBMS capabilities (Cont.)
• Allow users to create databases and specify
their schema, using data-definition language.
• Allow users to query and modify the data, using
data-manipulation language.
• Support the storage of very large amount of data
over a long period.
• Data consistency and failure recovery.
File System
• Why not using file system?
Can be used to store data information for a long
period as well.
Consistency and failure recovery capability
• Problems:
no query language, no efficient access for a data item
support of the creation of database is limited
consistency control is not adequate

Management of Data is complex


DBMS Evolution
• File Systems
• Hierarchical Model (Tree-based)
• Network Model (Graph-based)
• Relational Model
• Object Oriented Model
• Object/Relational Model
Relational Database System
• Ted Codd 1970
• The view of data: relations
relations, tuples, attributes
tables, rows, columns
• Queries could be expressed in high level
language, it is simple and efficient
• It is widely used in most commercial
systems
Example 1.1

Bank Account Information


(Accounts)
AccountN Balance Type
o
12345 1000.00 Savings
67890 2846.92 checking
… … …
Example 1.1 (Cont.)
• Check the balance
SELECT balance
FROM Accounts
WHERE accountNo= 67890
• Check the accountNo
SELECT accountNo
From Accounts
WHERE type=‘savings’ AND balance < 0
Major DBMS Products
• Oracle
• IBM: DB2, Informix
• Microsoft: SQL Server, Access
• Sybase
• MySQL
• Postgres

All are "relational" (or "object-relational") database


systems at their core.
Schema versus data
• Schema describes how data is to be
structured - defined at set-up time, rarely
changes (part of the "metadata")
• Data is actual "instance" of database, may
change rapidly
• Comparable to types and variables in
programming languages
Data Definition Language
(DDL)
• Commands for setting up schema of
database
• Process of designing schema can be
complex, may use design methodology
and/or tool
Data Manipulation Language
(DML)
• Commands to manipulate data in
database: RETRIEVE, INSERT, DELETE,
MODIFY
• Also called "query language"
People
• DBMS implementer: builds system
• Database designer: establishes schema
• Database administrator: loads data,
keeps whole thing running
• Database user: queries/modifies data
DBMS Evolution Trends

• Size
smaller and smaller
using personal computer, similar to applications such as
spreadsheet and word processing
bigger and bigger
terabytes or even petabytes data, using tertiary storage and parallel
computing techniques.
• Architecture
Client-server architecture (Two-Tier)
client database Server
Multi-Tier architecture:
client application server database server
DBMS Trends (Cont.)
• Versatile Data type
integers, characters
small storage requirement
videos, audios
large storage requirement
• Integration
Data warehouses, data mining
Data Definition Lang commands
• DDL commands are simpler to process
– E.g. the DBA for a university registrar’s DB might
decide that there should be a table or relation with
columns
SName Course Grade

– The DBA decides that the only allowable grades are


A,B,C,D and E.
• DBA needs special authority to execute
schema altering commands
– These have profound effect on the DB.
• These Schema altering commands are
parsed by DDL processor and passed to
the execution engine,
• Which then goes through the
index/file/record manager to alter the
Metadata, i.e. Schema information for DB
Main Memory Buffers and Buffer
manager
• The data of a DB normally resides in secondary
storage in computer system.
– Secondary storage means magnetic disks.
• To perform any useful operation on data , that
data must be in MMemory.
• Thus a DBMS component called buffer manager
is responsible for portioning the available MM
into buffers
– Which are page sized regions into which disk blocks
can be transferred.
Main Memory Buffers and Buffer
manager

• Thus all the DBMS components that need


information from disk will interact with the
buffers and the buffer manager ,
– either directly or through the execution
engine.
Query Processing
• A user or an application program initiates
some actions that does not affect the
schema of the DB, but may affect the
content of the DB (modification) or will
extract data from DB (query).
• There are two paths along which user
actions affect the DB.
Answering the Query
• The query is optimized and parsed by a query compiler.
• The resulting query plan , or sequence of actions to be
taken to answer the query , is passed to the execution
engine.
• The execution engine issues a sequence of request for
small pieces of data,
• Typically records or tuples of a relation., to a resource
manger that knows about data files9holding relations),
– The format and size of records in these files, and index files ,
which help find elements of data files quickly.
• The request for data are translated into pages ,
– These requests are passed to buffer manager.
• The role of buffer manger is to bring
appropriate portion of the data from
secondary storage where it is kept
permanently, to main memory buffers.
• The buffer manger communicates with a
storage manager to get data from disk.
Query Processor
• It is represented by two components
– Query compiler and Execution engine
• The query compiler , which translates the query into an
internal from called a query plan
– Query Plan is a sequence of operations to be performed on
the data.
• The query compiler consists of three major units
– A query parse , which builds a tree structure from the textual
from of the query.
– A query preprocessor which performs semantic checks on the
query.
– A query optimizer, which transforms the initial query plan into
best available sequence of operations on the actual data
Query Processor (cont..)
• The query compiler uses meta data and
statics about data to decide which
sequence of operations is likely to be
fastest.
Query Processor
• Execution Engine
– Has the responsibility for executing each of the steps
in the chosen query plan .
– The execution engine interacts with most of the other
components of the DBMS, either directly or through
the buffer.
– It must get the data from the DB into buffers in order
to manipulate that data.
– It needs to interact with the scheduler to avoid
accessing data that is locked , and with log manager
to make sure that all DB changes are properly logged.
Transaction Processing
• Queries and other actions are grouped into
transactions
• The transaction manager accepts
transaction commands from an application,
– Which tell the transaction manager when
transaction begin and end ,as well as
information about expectation of the
application.
Transaction Processing
• The transaction processor perform following
Tasks:
• Logging
– In order to assure durability , every change in the DB
is logged separately on the disk.
– Log manager follows one of the several policies
designed to assure when a system failure or crash
occurs .
– A recovery manager will be available to examine the
log of changes and restore the DB to some consistent
state
Overview of DBMS
• DDL commands
DBA DDL Complier Execution engine …
• Query Processing
– Answering the query
User Query Compiler Execution engine

– Transaction processing
Storage and Buffer
Management
• Buffer manager
• Storage manager
– Data: the contents of the database
– Metadata (Schema) : structure of the
database
– Statistics: data properties
– Indexes
Transaction Processing
• Transaction manager
– Logging
– Concurrency control
– Deadlock resolution
Query Processor
• Query complier
– Query parser
– Query preprocessor
– Query optimizer
• Execution engine
Outline of Database System
• Database design
Determine the database structure
• Database programming
Perform database operations
• Database system implementation
Build the database
End of Chapter 1

Вам также может понравиться