0% found this document useful (0 votes)
6 views

Lecture 01 Intro

Uploaded by

mamsohag
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Lecture 01 Intro

Uploaded by

mamsohag
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

CS3200 – Database Design・ ・・ Spring 2018・ ・・ Derbinsky

Database Management Systems:


An Architectural View
Lecture 1

Database Management Systems: An Architectural View

January 6, 2018 1
CS3200 – Database Design・ ・・ Spring 2018・ ・・ Derbinsky

Outline
1. What is a Database? A DBMS?
2. Why use a DBMS?
3. Databases in Context
4. Design and Implementation Process

Database Management Systems: An Architectural View

January 6, 2018 2
CS3200 – Database Design・ ・・ Spring 2018・ ・・ Derbinsky

What is a Database?

Database Management Systems: An Architectural View

January 6, 2018 3
CS3200 – Database Design・ ・・ Spring 2018・ ・・ Derbinsky

What is a Database?

Database Management Systems: An Architectural View

January 6, 2018 4
CS3200 – Database Design・ ・・ Spring 2018・ ・・ Derbinsky

What is a Database?
A collection of related data, most often…
– reflects some aspect of the real world
– logically coherent with inherent meaning
– designed, built, and populated with data for a
specific purpose
• intended group of users
• some preconceived applications with which these
users are interested
• application requirements in terms of performance,
security, redundancy, concurrency, etc.

Database Management Systems: An Architectural View

January 6, 2018 5
CS3200 – Database Design・ ・・ Spring 2018・ ・・ Derbinsky

Database Management System


DBMS

A collection of programs that enables users


to create and maintain a database
– Supports specifying the data types,
structures, and constraints of the data
– Stores the data on some medium under
control of the DBMS
– Supports querying and updating the
database
– Protects data against malfunction and
unauthorized access
Database Management Systems: An Architectural View

January 6, 2018 6
CS3200 – Database Design・ ・・ Spring 2018・ ・・ Derbinsky

Why use a DBMS?


Common tradeoff in CS:
A. Code from scratch
• Pros: you know your problem best (so fast, customized)
• Cons: slow, labor intensive, need to add/change features?

B. Find a library/tool that solves [part of] your problem


• Pros: fast via bootstrapping, better designed?
• Cons: understand the tool, may not be efficient, support?

DBMSs adopt some set of limiting assumptions in


order to efficiently support a useful feature set over
a wide class of possible databases
Database Management Systems: An Architectural View

January 6, 2018 7
CS3200 – Database Design・ ・・ Spring 2018・ ・・ Derbinsky

Example: Student Records


• Given a school with MANY students (NEU: ~25k, UM: ~45k), each
with some data (name, ID, DOB, classes)

• Write a program that can efficiently…


– Retrieve a random student
– Retrieve the first/last student, according to…
• Last name
• DOB
– Retrieve a student by…
• ID
• Name (with *’s)
– Retrieve a class roster (all students in class X)
– Handles adding/removing/editing students/classes
– Handles multiple simultaneous reads/writes
– Provides differing access rights
– Handles OS faults/power outages

Database Management Systems: An Architectural View

January 6, 2018 8
CS3200 – Database Design・ ・・ Spring 2018・ ・・ Derbinsky

Many Kinds of DBMSs (1)


• Graph databases
– Create nodes, edges, labels
– Query about relationships and paths
• Find your friends
• Find someone that can help you learn databases

• Spatial databases
– Objects in 2D/3D
– Query locations, relations
• Collision detection

Database Management Systems: An Architectural View

January 6, 2018 9
CS3200 – Database Design・ ・・ Spring 2018・ ・・ Derbinsky

Many Kinds of DBMSs (2)


• Document stores
– Create dynamic documents
– Query about contents
• Find by author, title, content, etc. patterns

• Key-Value stores
– Associative array
– Scalable, fault-tolerant
– Query

Database Management Systems: An Architectural View

January 6, 2018 10
CS3200 – Database Design・ ・・ Spring 2018・ ・・ Derbinsky

Relational DBMS
We focus on relational databases

Based on the relational data model


– Researched ~45 years, widely used
• Free/paid implementations for personal use,
embedded systems, small/large enterprise

Database Management Systems: An Architectural View

January 6, 2018 11
CS3200 – Database Design・ ・・ Spring 2018・ ・・ Derbinsky

Relational Databases (1)


Table or “Relation”
Table Name Attributes/Columns

STUDENT
Name SSN Phone Address Age GPA

Rows/ Ben Bayer 305-61-2435 555-1234 1 Foo Lane 19 3.21


Tuples Chung-cha Kim 422-11-2320 555-9876 2 Bar Court 25 3.53
Barbara Benson 533-69-1238 555-6758 3 Baz Blvd 19 3.25

Has to be Must be an Must be a


Constraints
unique integer > 0 number [0,4]

Database Management Systems: An Architectural View

January 6, 2018 12
CS3200 – Database Design・ ・・ Spring 2018・ ・・ Derbinsky

Relational Databases (2)


More Tables!
STUDENT
Name SSN Phone Address Age GPA
Ben Bayer 305-61-2435 555-1234 1 Foo Lane 19 3.21
Chung-cha Kim 422-11-2320 555-9876 2 Bar Court 25 3.53
Barbara Benson 533-69-1238 555-6758 3 Baz Blvd 19 3.25
CLASS
SSN Class
DORM 305-61-2435 COMP355
SSN Dorm 422-11-2320 COMP355
Values in one table can be 305-61-2435 555 Huntington 533-69-1238 MATH650
forced to come from 422-11-2320 Baker 305-61-2435 MATH650
another
(“Referential Integrity”) 533-69-1238 555 Huntington 422-11-2320 BIOL110

Database Management Systems: An Architectural View

January 6, 2018 13
CS3200 – Database Design・ ・・ Spring 2018・ ・・ Derbinsky

Relational Databases (3)


Queries!
STUDENT
Name SSN Phone Address Age GPA
Ben Bayer 305-61-2435 555-1234 1 Foo Lane 19 3.21 Result
Chung-cha Kim 422-11-2320 555-9876 2 Bar Court 25 3.53 3.23
Barbara Benson 533-69-1238 555-6758 3 Baz Blvd 19 3.25
CLASS
What is the average GPA
of students in MATH650? SSN Class
1. Find all SSN in table DORM 305-61-2435 COMP355
Class where SSN Dorm 422-11-2320 COMP355
Class=MATH650
2. Find all GPA in table 305-61-2435 555 Huntington 533-69-1238 MATH650
Student where 422-11-2320 Baker 305-61-2435 MATH650
SSN=#1
533-69-1238 555 Huntington 422-11-2320 BIOL110
3. Average GPA in #2
Database Management Systems: An Architectural View

January 6, 2018 14
CS3200 – Database Design・ ・・ Spring 2018・ ・・ Derbinsky

Relational Databases (3)


Queries!
STUDENT
Name SSN Phone Address Age GPA
Ben Bayer 305-61-2435 555-1234 1 Foo Lane 19 3.21 Result
Chung-cha Kim 422-11-2320 555-9876 2 Bar Court 25 3.53 3.23
Barbara Benson 533-69-1238 555-6758 3 Baz Blvd 19 3.25
CLASS
SSN Class
DORM 305-61-2435 COMP355
SSN Dorm 422-11-2320 COMP355
SELECT AVG(STUDENT.GPA)
FROM 305-61-2435 555 Huntington 533-69-1238 MATH650
STUDENT INNER JOIN CLASS
422-11-2320 Baker 305-61-2435 MATH650
ON STUDENT.SSN=CLASS.SSN
WHERE CLASS.Class='MATH650'; 533-69-1238 555 Huntington 422-11-2320 BIOL110

Database Management Systems: An Architectural View

January 6, 2018 15
CS3200 – Database Design・ ・・ Spring 2018・ ・・ Derbinsky

Relational Databases (4)


Users!
DBMS Application Server Clients

Database Management Systems: An Architectural View

January 6, 2018 16
CS3200 – Database Design・ ・・ Spring 2018・ ・・ Derbinsky

Databases in Context
Three-Tier Architecture

Database Management Systems: An Architectural View

January 6, 2018 17
CS3200 – Database Design・ ・・ Spring 2018・ ・・ Derbinsky

Relational DBMS Features (1)


• Data independence via data models
– Conceptual representation independent of underlying
storage or operation implementation

ER Diagrams

Relations

Database Management Systems: An Architectural View

January 6, 2018 18
CS3200 – Database Design・ ・・ Spring 2018・ ・・ Derbinsky

Relational DBMS Features (2)


• Operation abstraction via…

– Declarative languages
• Structured Query Language (SQL)
– Data… definition, manipulation, query

– Programmatic APIs
• Function libraries (focus), embedded languages,
stored procedures, etc.

Database Management Systems: An Architectural View

January 6, 2018 19
CS3200 – Database Design・ ・・ Spring 2018・ ・・ Derbinsky

Relational DBMS Features (3)


• Reliable concurrent transactions
– (A)tomicity: “all or nothing”
– (C)onsistency: valid -> valid’
– (I)solation: parallel execution, serial result
– (D)urability: once it is written, it is so

• High performance
– Buffering, caching, locking (like a mini OS)
– Query optimization, redundant data
structures (e.g. indexes, materialized views)
Database Management Systems: An Architectural View

January 6, 2018 20
CS3200 – Database Design・ ・・ Spring 2018・ ・・ Derbinsky

Relational DBMS Features (4)


• Authentication and authorization
– Discussed in context of other security
concerns/techniques

• Backup and recovery


– Logging, replication, migration

Database Management Systems: An Architectural View

January 6, 2018 21
CS3200 – Database Design・ ・・ Spring 2018・ ・・ Derbinsky

Why NOT to use a DBMS


Your application…
• involves a single user
• has simple/well-defined data/operations
– DBMS may be overkill

However, DBMS techniques may be useful


– We will discuss useful and scalable indexing
structures and processes

Database Management Systems: An Architectural View

January 6, 2018 22
CS3200 – Database Design・ ・・ Spring 2018・ ・・ Derbinsky

Databases in Context
People

1. Database designers
2. System analysts & application
programmers
3. Database administrators
4. End users
5. Back-end
a. DBMS designer/implementer
b. Tool developers
c. SysAdmins
Database Management Systems: An Architectural View

January 6, 2018 23
CS3200 – Database Design・ ・・ Spring 2018・ ・・ Derbinsky

Relational DBMS

Database Management Systems: An Architectural View

January 6, 2018 24
CS3200 – Database Design・ ・・ Spring 2018・ ・・ Derbinsky

Database Design and Implementation Process

Database Management Systems: An Architectural View

January 6, 2018 25
CS3200 – Database Design・ ・・ Spring 2018・ ・・ Derbinsky

Requirements Collection & Analysis


• Data/Constraints
“The company is organized
into departments. Each
department has a unique
name, number, and a
particular employee who
manages the department. We
keep track…”

• Functional Needs
– Operations/queries/reports
• Frequency
– Performance, security, etc.

Database Management Systems: An Architectural View

January 6, 2018 26
CS3200 – Database Design・ ・・ Spring 2018・ ・・ Derbinsky

Conceptual Design
Data Application
• Software
– UML
– Form design

• Database
– Transaction design
– Report design

Database Management Systems: An Architectural View

January 6, 2018 27
CS3200 – Database Design・ ・・ Spring 2018・ ・・ Derbinsky

Logical Design
Data Application
• Supporting code (that
does not depend upon
database)
– Possibly using techniques
from databases (e.g.
indexing)

• Normalization

Database Management Systems: An Architectural View

January 6, 2018 28
CS3200 – Database Design・ ・・ Spring 2018・ ・・ Derbinsky

Physical Design
Data Application
• Index, materialized view • Implementing operations
selection and analysis as queries
• Implementing constraints
as keys, triggers, views
• Implementing multi-user
security as grants

Database Management Systems: An Architectural View

January 6, 2018 29
CS3200 – Database Design・ ・・ Spring 2018・ ・・ Derbinsky

Implementation and Tuning


Data Application
• DDL statements • Query integration
• De-normalization, • Profiling
updating queries/operations
indexes/materialized • Security, concurrency,
views performance, etc.
analysis

Database Management Systems: An Architectural View

January 6, 2018 30
CS3200 – Database Design・ ・・ Spring 2018・ ・・ Derbinsky

Summary
• A database is a collection of related data that reflects
some aspect of the real world; is logically coherent
with inherent meaning; and is designed, built, and
populated with data for a specific purpose
• A database management system (DBMS) is a
collection of programs that enables users to create
and maintain a database
• There are many types – we will focus on relational
databases (RDBMS)
• The typical database design process is an iterative
process of requirements collection/analysis,
conceptual design, logical design, physical design,
and system implementation/tuning
Database Management Systems: An Architectural View

January 6, 2018 31

You might also like