1. File Systems and Databases

Download Report

Transcript 1. File Systems and Databases

Database Systems
Ch1: File Systems and
Databases
Hachim Haddouti
Agenda
•
•
•
•
•
•
Motivation
History
File Systems
Database Systems
Data models
Summary
DBMS, Ch1 File Systems and Databases, Hachim Haddouti
Why Database?
• DBMS contains information about a particular
enterprise
• DBMS provides an environment that is both
convenient and efficient to use.
• Database Applications:
–
–
–
–
–
Banking: all transactions
Airlines: reservations, schedules
Universities: registration, grades
Sales: customers, products, purchases
Manufacturing: production, inventory, orders, supply
chain
– Human resources: employee records, salaries, tax
deductions
• Databases touch all aspects of our lives
DBMS, Ch1 File Systems and Databases, Hachim Haddouti
History
1.
2.
3.
4.
File systems
Pre-relational Databases
Relational Databases
Post-relational Databases
DBMS, Ch1 File Systems and Databases, Hachim Haddouti
History (cont.)
Pre-relational DB (70)
• First distinction between logical and physical data management
• Data management becomes important.
• Need of data models
Relational Database Systems (80)
• No redundancy in data storage
• Integrated data control even by distributed data storage
• Multiuser operation and high performance
Post-relational Databases (90)
• objectoriented Databases
• Multidimentional Databases
• Datawarehouses
• Distributed databases
DBMS, Ch1 File Systems and Databases, Hachim Haddouti
A Simple File System
DBMS, Ch1 File Systems and Databases, Hachim Haddouti
Drawbacks of file Systems
• To retrieve data from a file system, extensive programming
is often needed in a 3GL - both what and how are
programmer’s responsibility
• Ad hoc queries (spur-of-the-moment questions) become
impossible
• Each file must have its own file-mgt. system to create the
file structure, add data to file, delete data from it, modify it
and list its contents
• All data access programs are subject to change when the
file structure changes (e.g., a field is deleted or its position
is changed)
• Structural dependency
• Even a change in the data type of a field (e.g., integer to
real) requires all data access programs to change
• Data dependency
DBMS, Ch1 File Systems and Databases, Hachim Haddouti
Purpose of Database System
• In the early days, database applications were built on top of
file systems
• Drawbacks of using file systems to store data:
– Data redundancy and inconsistency
• Multiple file formats, duplication of information in different files
– Difficulty in accessing data
• Need to write a new program to carry out each new task
– Data isolation — multiple files and formats
– Integrity problems
• Integrity constraints (e.g. account balance > 0) become part
of program code
• Hard to add new constraints or change existing ones
DBMS, Ch1 File Systems and Databases, Hachim Haddouti
Purpose of Database Systems (Cont.)
• Drawbacks of using file systems (cont.)
– Atomicity of updates
• Failures may leave database in an inconsistent state with partial
updates carried out
• E.g. transfer of funds from one account to another should either
complete or not happen at all
– Concurrent access by multiple users
•
• Concurrent accessed needed for performance
• Uncontrolled concurrent accesses can lead to inconsistencies
– E.g. two people reading a balance and updating it at the same
time
– Security problems
Database systems offer solutions to all the above problems
DBMS, Ch1 File Systems and Databases, Hachim Haddouti
DBMS vs. File Systems?
•
Database consists of
logically
related
data
stored
in
a
single
repository
•
Provides advantages over
file system management
approach
–
Eliminates
inconsistency,
data
anomalies,
data
dependency,
and
structural
dependency
problems
–
Stores data structures,
relationships,
and
access paths
DBMS, Ch1 File Systems and Databases, Hachim Haddouti
Levels of Abstraction
• Physical level describes how a record (e.g.,
customer) is stored.
• Logical level: describes data stored in database,
and the relationships among the data.
type customer = record
name : string;
street : string;
city : integer;
end;
• View level: application programs hide details of
data types. Views can also hide information (e.g.,
salary) for security purposes.
DBMS, Ch1 File Systems and Databases, Hachim Haddouti
View of Data
An architecture for a database system
DBMS, Ch1 File Systems and Databases, Hachim Haddouti
DBMS Functions
•
Data dictionary: stores data relationships to be
consulted by all programs that access the database;
automatically records changes
• Structural and data dependencies are
eliminated
•
Interaction with the file manager: takes care of
structures for data storage
•
Security: enforces data access policies
•
Multi-user access control
•
Backup and recovery
•
Data integrity
•
Data access through 4GL and 3GL’s
DBMS, Ch1 File Systems and Databases, Hachim Haddouti
Types of Database Systems
– Number of Users
• Single-user (Desktop database)
• Multi-user (Enterprise database)
– Location
• Centralized
• Distributed
– Use
• Transactional (Production)
• Decision support
• Data warehouse
DBMS, Ch1 File Systems and Databases, Hachim Haddouti
Database Models
•
A database model is a collection of logical constructs used to represent the data
structure and the data relationships found within the database.
•
Two Categories of Database Models
– Conceptual models focus on the logical nature of the data representation.
They are concerned with what is represented rather than how it is
represented.
– Implementation models place the emphasis on how the data are
represented in the database or on how the data structures are implemented.
DBMS, Ch1 File Systems and Databases, Hachim Haddouti
Database Models
• Three Types of Relationships
– One-to-many relationships (1:M)
• A painter paints many different paintings, but each one of them is
painted by only that painter.
– PAINTER (1) paints PAINTING (M)
– Many-to-many relationships (M:N)
• An employee might learn many job skills, and each job skill might be
learned by many employees.
– EMPLOYEE (M) learns SKILL (N)
– One-to-one relationships (1:1)
• Each store is managed by a single employee and each store manager
(employee) only manages a single store.
– EMPLOYEE (1) manages STORE (1)
DBMS, Ch1 File Systems and Databases, Hachim Haddouti
Database Models
• Three Types of Implementation
Database Models
– Hierarchical database model
– Network database model
– Relational database model
DBMS, Ch1 File Systems and Databases, Hachim Haddouti
A Hierarchical Structure
DBMS, Ch1 File Systems and Databases, Hachim Haddouti
Hierarchical Model
– Advantages
•
•
•
•
•
Conceptual simplicity
Database security
Data independence
Database integrity
Efficiency dealing with a large database
– Disadvantages
•
•
•
•
•
•
Complex implementation
Difficult to manage
Lacks structural independence
Applications programming and use complexity
Implementation limitations
Lack of standards
DBMS, Ch1 File Systems and Databases, Hachim Haddouti
Child with Multiple Parents
DBMS, Ch1 File Systems and Databases, Hachim Haddouti
A Network Database Model
DBMS, Ch1 File Systems and Databases, Hachim Haddouti
Network Database Model
Advantages
• Conceptual simplicity
• Handles more relationship types
• Data access flexibility
• Promotes database integrity
• Data independence
• Conformance to standards
Disadvantages
• System complexity
• Lack of structural independence
DBMS, Ch1 File Systems and Databases, Hachim Haddouti
Relational Database Model
– Basic Structure
• RDBMS allows operations in a human logical
environment.
• The relational database is perceived as a
collection of tables.
• Each table consists of a series of row/column
intersections.
• Tables (or relations) are related to each other by
sharing a common entity characteristic.
• The relationship type is often shown in a relational
schema.
• A table yields complete data and structural
independence.
DBMS, Ch1 File Systems and Databases, Hachim Haddouti
Linking Relational Tables
DBMS, Ch1 File Systems and Databases, Hachim Haddouti
Relational Database Model
Advantages
• Structural independence
• Improved conceptual simplicity
• Easier database design, implementation,
management, and use
• Ad hoc query capability (SQL)
• Powerful database management system
Disadvantages
• Substantial hardware and system software
overhead
• Possibility of poor design and
implementation
• Potential “islands of information” problems
DBMS, Ch1 File Systems and Databases, Hachim Haddouti
Summary
– File systems
– History
– DBMS
– Data models
DBMS, Ch1 File Systems and Databases, Hachim Haddouti