Lecture#02 FileSystemAndDB
Lecture#02 FileSystemAndDB
SYSTEMS
Week-02
Course Objectives
In this course we aim at studying:
Parallel and
distributed
Connection with DBMSs, NoSQL
various DBMS
How to refine
and speed up
How to query data retrieval
and manipulate and
How to design databases manipulation
and implement
databases from
‘cradle-to-grave’
1. Types of Data
2. Drawbacks of File System
3. Advantages of DBMS
4. ACID property
5. SQL vs NoSQL
3
Files
4
File System
DBMS
5
Drawbacks of File System
6
1. Data Redundancy & Data Inconsistency
OFFICE
LIBRARY
Accounts
OFFICE
LIBRARY
Accounts
2. Difficulty in Accessing Data
OFFICE
LIBRARY
ACCOUNT
3. Data Isolation
4. Integrity Problems
5. Atomicity Problems
Account A Account B
17
4. Concurrent Access: Multiple users can access the database
at the same time when we are using the Database
Management System.
19
ACID Property
20
Cont..
21
Cont..
22
Cont..
23
Quiz
Find at least 2 design errors in the given database
24
Types of Data
Types
Structured Unstructured
Data Data
25
Structured Data
26
Structured Data
RDBMS
28
Types of Databases
29
Horizontal Vs. Vertical
Scaling Horizontal scaling Vertical scaling
Add or reduce the number of virtual Add or reduce the CPU or memory
Example
machines (VM) in a cluster of VMs capacity of the existing VM
This requires modifying a sequential piece No need to change the logic. The
Configuration of logic in order to run workloads same code can run on a higher-
concurrently on multiple machines spec device
Low because other machines in the cluster High since it’s a single source of
Failure
offer backup failure
Low-cost initially; less cost-
Costs High costs initially; optimal over time
effective over time
Slower machine-to-machine
Networking Quick inter-machine communication
communication
Performance Higher Lower
Limited to the resource capacity
Limitation Add as many machines as you can
the single machine can handle
31
Architectures
32
SQL
■ It has a predefined schema.
■ Add Nil if data is not present (Memory Wastage)
■ Change Schema or Data in case of modifications
■ Tabular format
■ Not easily scalable (designed for 90’s technology or
worse)
■ Requires joins
33
NoSQL
■ Schema-less Database
■ Change can be easily incorporated
Key/value (Dynamo)
Columnar/tabular
(HBase)
Document (mongoDB)
34
SQL vs NoSQL
35
Is NoSQL better than SQL?
36
When to Choose SQL
Structured Data: If your data has a well-defined schema with fixed
tables and relationships between them, SQL databases are a
good choice.
37
When to Choose NoSQL
Flexible Schema: NoSQL databases are schema-less or have a
flexible schema, making them suitable for projects with
evolving Ultimately, the
or unstructured choice between
data.
SQL and NoSQL databases
depends
High Throughput: NoSQL on databases
the dataare structure,
often chosen for high-
velocity scale,
applications with large volumes of data and high
performance
read/write rates, such as social media platforms, IoT, and
requirements,
real-time analytics.
and the
development team's familiarity
Horizontal with theNoSQL
Scalability: technology.
databasesInaresomedesigned for easy
horizontal cases,
scaling. a They
hybrid
canapproach using
distribute data across multiple
servers or bothnodes,
types providing excellent within
of databases scalability and fault
tolerance.
the same project may be the
Variety of most appropriate
Data Models: solutioncome
NoSQL databases to in different
take
flavors, including advantage
document-orientedof (e.g.,
their
MongoDB), key-
value stores (e.g., strengths.
respective Redis), column-family stores (e.g.,
Cassandra), and graph databases (e.g., Neo4j). You can
choose the NoSQL type that best matches your data and
query requirements. 38
QUESTIONS