IT244 Week 1
IT244 Week 1
26/12/2021
College of Computing and Informatics
Data Science Pre-Master Program
IT244
Introduction to Database
IT244
Introduction to Database
Week 1
Orientation and Introduction
Contents
1. Understand the Major Objective of Saudi Vision 2030
2. Demonstrate the Saudi Digital Library and searching for
knowledge
3. Databases and Database Users
4. Introduction to NOSQL
Weekly Learning Outcomes
1. Understand the Major Objective of Saudi Vision 2030.
2. Demonstrate the Saudi Digital Library and searching for
knowledge.
3. Explain the basic concepts of Database.
Required Reading
1. Chapter 1: The Complete chapter
2. Chapter 24: Introduction to NOSQL
(Fundamentals of Database Systems, Global Edition, 7th Edition (2017) by Ramez
Elmasri & Shamkant Navathe)
Recommended Reading
Saudi Digital Library: https://sdl.edu.sa/sdlportal/en/publishers.aspx
Introduction to Database Management Systems:
https://courses.cs.vt.edu/cs4604/Spring21/pdfs/1-intro.pdf
This Presentation is mainly dependent on the textbook: Fundamentals of Database Systems, Global Edition, 7th Edition (2017) by Ramez Elmasri & Shamkant Navathe
• Saudi Vision 2030
Weekly
Learning
Outcomes
Saudi Vision 2030
Reference: https://www.vision2030.gov.sa/
Saudi Vision 2030
1. Saudi Arabia is the land of the Two Holy Mosques which positions the
Kingdom at the heart of the Arab and Islamic worlds
Reference: https://www.vision2030.gov.sa/
• Saudi Digital Library
Weekly
Learning
Outcomes
Saudi Digital Library
Reference: https://sdl.edu.sa/sdlportal/en/publishers.aspx
Saudi Digital Library
• Advantages:
• One central management, manages this huge content, and constantly
updated.
• Common share for the benefit of, any University would benefit other
universities that are now available to the other, in any scientific field.
• Enhance the status of universities when evaluating, for Academic
Accreditation, and through sources rich, modern, and publish the best
Global Publishers.
• Bridging the gap between Saudi universities, where emerging
universities can get the same service, you get major Saudi universities.
Reference: https://sdl.edu.sa/sdlportal/en/publishers.aspx
• Databases and Database Users
Chapter 1 Outline
Types of Databases and Database Applications
Basic Definitions
Typical DBMS Functionality
Example of a Database (UNIVERSITY)
Main Characteristics of the Database Approach
Types of Database Users
Advantages of Using the Database Approach
When Not to Use Databases
Introduction to NOSQL
Basic Definitions(1)
Data
Known facts that can be recorded and have an implicit meaning.
Example: the names, telephone numbers, and addresses of the people you know
Database
A collection of related data in a DBMS.
Example: the list of names and addresses, and computerized catalog of a large library
Defining a database
Involves specifying the data types, structures, and constraints of the data to be stored in the
database.
Meta-data
The database definition or descriptive information is also stored by the DBMS in the form of
a database catalog or dictionary.
Database Management System (DBMS)
A computerized system that enables users to create and maintain a database. It is a general-
purpose software system that facilitates the processes of defining, constructing,
manipulating, and sharing databases among various users and applications.
Database System
The database and DBMS software together; Sometimes, the application programs and
interfaces are also included.
Basic Definitions(2)
Manipulating a database
Includes querying the database to retrieve specific data, updating the database, and
generating reports from the data.
Sharing a database
Allows multiple users and programs to access the database simultaneously.
Application program
Accesses the database by sending queries or requests for data to the DBMS.
Query
A query causes some data to be retrieved from the database.
Transaction
May cause some data to be read from and some data to be written into the database.
Protection
May includes system protection against hardware or software malfunction (or crashes) and
security protection against unauthorized or malicious access.
Maintenance
A typical large database has a life cycle of many years, so the DBMS must be allowing the
system to evolve as requirements change over time.
Simplified database system environment
Implicit Properties of a Database
DEPARTMENTs
COURSEs
Note: The above entities and relationships are typically expressed in the ENTITY-
RELATIONSHIP data model
Example of a Database UNIVERSITY
Application(2)
Example of a Database UNIVERSITY
Application(3)
Typical DBMS Functionality
Define a particular database in terms of its data types, structures, and
constraints
Construct or Load the initial database contents on a secondary storage
medium
Manipulating the database:
Retrieval: Querying, generating reports
Modification: Insertions, deletions and updates to its content
Accessing/changing the database through Web applications
Processing and Sharing by a set of concurrent users and application
programs
Protection or Security measures to prevent unauthorized access
“Active” processing to take internal actions on data
Presentation and Visualization of data
Maintaining the database and associated programs over its lifetime
Main Characteristics of the Database
Approach(1)
Self-describing nature of a database system:
A DBMS catalog stores the description of a particular database
The description is called meta-data
This allows the DBMS software to be integrated with different database
applications
Insulation between programs and data:
Allows changing data structures and data storage organization without having to
change the DBMS access programs.
Accomplished through data abstraction
A data model is used to hide storage details and present the users with a conceptual
view of the database.
Programs refer to the data model constructs rather than data storage details Called
program-data independence.
Main Characteristics of the Database Approach (2)
Support of multiple views of the data:
Each user may see a different view of the database, which
describes only the data of interest to that user.
Sharing of data and multi-user transaction processing:
Allowing a set of user transactions to access and update the
database concurrently (at the same time).
Concurrency control within the DBMS guarantees that each
transaction is correctly executed or aborted
Recovery subsystem ensures each completed transaction has its
effect permanently recorded in the database
OLTP (Online Transaction Processing) is a major part of database
applications (allows hundreds of concurrent transactions to
execute per second)
Example of meta-date in a simplified database
catalog
Types of Database Users (Actors on the
scene)
Database administrators:
Responsible for authorizing/controlling access to the database; coordinating
and monitoring its use; acquiring software and hardware resources; and
monitoring efficiency of operations. The DBA is accountable for security
breaches and poor system response time.
Database Designers:
Responsible for defining database structure, constraints, and transactions;
communicate with users to understand their needs.
End-users: Use the database for queries, reports, and updating the database
content. Can be categorized into:
Casual end-users: access database occasionally when needed
Adopted from slides and/or materials by P. Hoekstra, J. Lu, A. Lakshman, P. Malik, J. Lin, R. Sunderraman, T. Ivarsson, J. Pokorny, N. Lynch, S. Gilbert, J. Widom, R. Jin, P. McFadin, C. Nakhli, and R. Ho
Background
• Relational databases are suitable for conventional business applications
• In the first decade of the twenty-first century, the proliferation of social
media Web sites, large e-commerce companies, Web search indexes, and
cloud storage/backup led to a surge in the amount of data stored on large
databases and massive servers.
• Employing DBMS/RDBMS to web-based application create problems
• New types of database systems were necessary to manage these huge
databases with fast search and retrieval as well as reliable and safe storage of
nontraditional types of data, such as social media posts and tweets.
• Web-based applications require more than the DBMS/RDBMS can provide
• Explosion of social media sites with very large data size
• Many cloud-based applications provide simple storage solution
35
Issues with scaling up
• Best way to provide ACID and rich query model is to have the dataset
on a single machine
• Limits to scaling up (or vertical scaling: make a “single” machine
more powerful) dataset is just too big!
• Scaling out (or horizontal scaling: adding more smaller/cheaper
servers) is a better choice
• Different approaches for horizontal scaling (multi-node database):
• Master/Slave
• Sharding (partitioning)
36
Scaling out RDBMS
• Master/Slave
• All writes are written to the master
• All reads performed against the replicated slave databases
• Critical reads may be incorrect as writes may not have been propagated down
• Large datasets can pose problems as master needs to duplicate data to slaves
• Sharding (Partitioning)
• Scales well for both reads and writes
• Not transparent, application needs to be partition-aware
• Can no longer have relationships/joins across partitions
• Loss of referential integrity across shards
• Other Ways
• Multi-Master replication
• INSERT only, not UPDATES/DELETES
• No JOINs, thereby reducing query time
• This involves de-normalizing data
• In-memory databases 37
NOSQL (1)
• The Name:
• Stands for Not Only SQL
• The term NOSQL was introduced by Carl Strozzi in 1998 to name his file-based
database
• It was again re-introduced by Eric Evans when an event was organized to
discuss open source distributed databases
• Eric states that “… but the whole point of seeking alternatives is that you need
to solve a problem that relational databases are a bad fit for. …”
38
NOSQL(2)
39
NOSQL(3)
• Disadvantages:
• Don’t fully support relational features
• No join, group by, order by operations (except within partitions)
• No referential integrity constraints across partitions
• No declarative query language (e.g., SQL) more programming
• Relaxed ACID (see CAP theorem) fewer guarantees
• No easy integration with other applications that support SQL
40
NOSQL categories
1. Key-value
• Example: DynamoDB, Voldermort, Scalaris
2. Document-based
• Example: MongoDB, CouchDB
3. Column-based
• Example: BigTable, Cassandra, Hbased
4. Graph-based
• Example: Neo4J, InfoGrid
• “No-schema” is a common characteristics of most NOSQL storage
systems
• Provide “flexible” data types
41
Key-value
• Focus on scaling to huge amounts of data
• Designed to handle massive load
• Based on Amazon’s dynamo paper
• Data model: (global) collection of Key-value pairs
• Dynamo ring partitioning and replication
• Example: (DynamoDB)
• items having one or more attributes (name, value)
• An attribute can be single-valued or multi-valued like set.
• items are combined into a table
• Basic API access:
• get(key): extract the value given a key
• put(key, value): create or update the value given its key
• delete(key): remove the key and its associated value
• execute(key, operation, parameters): invoke an operation to the value (given its key) which is a
special data structure (e.g. List, Set, Map .... etc)
42
Key-value
Pros:
• Very fast
• Very scalable (horizontally distributed to nodes based on key)
• Simple data model
• Eventual consistency
• Fault-tolerance
Cons:
• Can’t model more complex data structure such as objects
43
Document-based
• Can model more complex objects
• Inspired by Lotus Notes
• Data model: collection of documents
• Document: JSON (JavaScript Object Notation is a data model, key-value
pairs, which supports objects, records, structs, lists, array, maps, dates,
Boolean with nesting), XML, other semi-structured formats.
• Example: (MongoDB) document
• {Name:"Jaroslav",
Address:"Malostranske nám. 25, 118 00 Praha 1”,
Grandchildren: {Claire: "7", Barbara: "6", "Magda: "3", "Kirsten: "1", "Otis: "3", Richard:
"1“}
Phones: [ “123-456-7890”, “234-567-8963” ]
}
44
Document-based
45
Column-based
• Based on Google’s BigTable paper
• Like column oriented relational databases (store data in column order) but with a
twist
• Tables similarly to RDBMS, but handle semi-structured
• Data model:
• Collection of Column Families
• Column family = (key, value) where value = set of related columns (standard, super)
• indexed by row key, column key and timestamp
allow key-value pairs to be stored (and retrieved on key) in a massively parallel system
storing principle: big hashed distributed tables
properties: partitioning (horizontally and/or vertically), high availability etc.
completely transparent to application
46
Column-based
• One column family can have variable
numbers of columns
• Cells within a column family are sorted “physically”
• Very sparse, most cells have null values
• Comparison: RDBMS vs column-based NOSQL
• Query on multiple tables
• RDBMS: must fetch data from several places on disk and glue together
• Column-based NOSQL: only fetch column families of those columns that are required
by a query (all columns in a column family are stored together on the disk, so
multiple rows can be retrieved in one read operation data locality)
• Example: (Cassandra column family--timestamps removed for simplicity)
UserProfile = {
Cassandra = { emailAddress:”[email protected]” , age:”20”}
TerryCho = { emailAddress:”[email protected]” , gender:”male”}
Cath = { emailAddress:”[email protected]” , age:”20”,gender:”female”,address:”Seoul”}
}
47
Column-based
Name Producer Data model Querying
48
Graph-based
• Focus on modeling the structure of data (interconnectivity)
• Scales to the complexity of data
• Inspired by mathematical Graph Theory (G=(E,V))
• Data model:
• (Property Graph) nodes and edges
• Nodes may have properties (including ID)
• Edges may have labels or roles
• Key-value pairs on both
• Interfaces and query languages vary
• Single-step vs path expressions vs full recursion
• Example:
• Neo4j, FlockDB, Pregel, InfoGrid …
49
Conclusion
50
Main Reference
1. Chapter 1: The Complete chapter
2. Chapter 24: Introduction to NOSQL
(Fundamentals of Database Systems, Global Edition, 7th Edition (2017) by Ramez
Elmasri & Shamkant Navathe)
Additional References
Saudi Digital Library:
https://sdl.edu.sa/sdlportal/en/publishers.aspx
https://courses.cs.vt.edu/cs4604/Spring21/pdfs/1-intro.pdf
This Presentation is mainly dependent on the textbook: Fundamentals of Database Systems, Global Edition, 7th Edition (2017) by Ramez Elmasri & Shamkant Navathe
Thank You