Introduction To Advanced Data Models
Introduction To Advanced Data Models
Models
Object-Oriented & Object-Relational
Data Models (In-Depth)
Rows (tuples)
Columns (attributes)
Tables (relations)
This works well for simple data, but modern systems need to handle:
Scientific data
1.
2.
3.
4.
5.
No behavior (methods)
→ Only data, no functions attached
6.
7.
Impedance mismatch
→ Gap between OOP languages and relational databases
8.
Advanced Data Models are database models that extend traditional relational
databases by supporting complex data structures, object identity, inheritance,
encapsulation, and user-defined data types, enabling better modeling of real-world
applications.
The Object-Oriented Data Model stores data as objects, similar to objects used in
object-oriented programming. Each object contains state (data) and behavior
(methods).
Example:
2. Objects
Example:
Object: Student
Attributes: id, name, GPA
Methods: calculateGPA(), enrollCourse()
3. Classes
Attribute definitions
Method definitions
Example:
Class: Account
Attributes: accountNo, balance
Methods: deposit(), withdraw()
4. Encapsulation
Encapsulation means:
Example:
5. Inheritance
Inheritance allows:
Code reuse
Hierarchical modeling
Example:
Person
├── Student
└── Teacher
✔ Reduces redundancy
✔ Represents real-world hierarchy
6. Polymorphism
Polymorphism allows:
Example:
calculateSalary()
→ Teacher: based on lectures
→ Staff: based on hours
7. Complex Objects
OODM supports:
Nested objects
Composite structures
Example:
2.
3.
4.
5.
6.
7.
Better maintainability
10.
2.
3.
4.
5.
6.
7.
Difficult optimization
8.
9.
10.
CAD/CAM systems
Engineering databases
Multimedia systems
Scientific simulations
Too complex
No standard SQL
Poor industry adoption
Example:
TYPE Address (
street VARCHAR,
city VARCHAR,
zip INT
)
2. Object Identity
Example:
4. Inheritance in Tables
Example:
Employee
└── Manager
✔ Reduces redundancy
Supports:
Arrays
Sets
Lists
Example:
4.4 Advantages of Object-Relational
Data Model
1.
2.
3.
SQL support
4.
5.
6.
7.
8.
9.
10.
Increased complexity
2.
3.
Vendor-specific implementations
4.
5.
8.
PostgreSQL
Oracle ORDB
IBM DB2
Informix
File organization acts as a bridge between logical database design and physical
storage. Even though users interact with tables logically, internally the DBMS uses
file organization methods to store and retrieve data efficiently.
Poor file organization can make a database extremely slow even if indexes exist.
In advanced database systems where data volume is very large and queries are
complex, efficient file organization is essential for scalability, reliability, and high
performance.
A file is a collection of related records stored on secondary storage. Each file usually
corresponds to a table in a database.
2.2 Record
A record is a collection of related fields that represent a single entity instance, such as
one student or one employee.
2.3 Field
A field is the smallest unit of data and represents an attribute of an entity, such as
name, age, or salary.
A block is the smallest unit of data transfer between disk and main memory. DBMS
always reads and writes data in blocks, not individual records.
Blocking factor represents the number of records that can be stored in a single block.
It depends on block size and record size and plays a vital role in performance
calculations.
3. Need and Importance of File
Organization
3.1 Efficient Disk Access
Disk access is much slower than memory access. Proper file organization reduces the
number of disk reads and writes.
Well-organized files allow the DBMS to locate records quickly, resulting in faster
query execution.
3.5 Scalability
As the database grows, proper file organization ensures that performance does not
degrade significantly.
1.
2.
3.
4.
5.
8.
9.
10.
Heap file organization stores records in no particular order. Records are inserted
wherever free space is available.
New records are usually placed at the end of the file or in any block that has enough
free space. This makes insertion very fast.
Searching requires a linear scan of all blocks because records are not ordered.
Records are marked as deleted, and the space is added to a free-space list. This may
lead to fragmentation.
5.5 Advantages
Simple to implement
Low overhead
5.6 Disadvantages
5.7 Applications
Heap files are used in temporary tables, log files, and situations where insertions are
frequent and searching is rare.
Sequential file organization stores records in a sorted order based on a search key.
Records are physically stored on disk in sorted order, and disk blocks follow the same
order.
Records are logically ordered using pointers while physical storage may not strictly
follow the order.
Binary search can be applied, making searching much faster than heap files.
6.5 Insertion Problem
6.7 Advantages
Efficient searching
6.8 Disadvantages
6.9 Applications
Hash file organization uses a hash function to map search keys to specific storage
locations called buckets.
When two keys map to the same bucket, collisions occur and are handled using
overflow buckets or chaining.
The number of buckets is fixed, which may cause performance degradation as data
grows.
Techniques like extendible hashing and linear hashing allow the number of buckets to
grow dynamically.
7.7 Advantages
7.8 Disadvantages
7.9 Applications
Built on a sorted file and usually contains one index entry per block.
Built on a non-key attribute and may contain multiple pointers for the same key value.
8.8 Advantages
8.9 Disadvantages
Clustered file organization stores related records physically close to each other on
disk.
9.5 Limitation
Got it 👍
Now I’m locking into full exam-mode.
Below are VERY DETAILED, long-answer–ready notes on:
1. Transactional Processing
1.1 Definition of Transactional
Processing
Transactional Processing refers to the management of database transactions in such
a way that the database remains correct, consistent, and reliable, even when
multiple users access it at the same time or when system failures occur. A transaction
is a sequence of database operations (read, write, update, delete) that are treated as
one logical unit of work. Either all operations are performed successfully, or none
of them are applied to the database.
1.2 Transaction
Definition
Explanation
A transaction starts with a BEGIN TRANSACTION statement and ends with either:
Transactions ensure that the database moves from one consistent state to another
consistent state.
Example
Bank transfer:
1.
2.
3.
4.
Both steps must succeed together. If one fails, the transaction is rolled back.
Explanation
If a transaction fails in the middle due to power failure, system crash, or software
error, atomicity ensures that the database is restored to its previous state.
Example
If money is deducted from one account but not added to another, atomicity will roll
back the deduction.
Advantages
Disadvantages
1.3.2 Consistency
Consistency ensures that a transaction brings the database from one valid state to
another valid state, following all rules, constraints, and integrity conditions.
Explanation
All constraints such as primary key, foreign key, and domain constraints must be
satisfied before and after the transaction.
Example
Advantages
Disadvantages
1.3.3 Isolation
Explanation
Even if multiple transactions are running at the same time, the result should be the
same as if they were executed one after another.
Example
Two users withdrawing money simultaneously should not see intermediate results.
Advantages
Disadvantages
1.3.4 Durability
Explanation
Ensures reliability
Disadvantages
2. Concurrency Control
2.1 Definition
Concurrency Control is the process of managing simultaneous execution of
transactions in a database system to ensure data consistency and isolation.
In multi-user databases, many transactions run at the same time. Concurrency control
ensures that these transactions do not interfere with each other in a harmful way.
Occurs when two transactions update the same data, and one update overwrites the
other.
Example:
Two users update the same account balance simultaneously, and one update is lost.
2.2.2 Dirty Read
Occurs when a transaction reads data written by another transaction that has not yet
committed.
Risk: If the second transaction rolls back, the first transaction has used invalid data.
Occurs when a transaction reads the same data twice and gets different values due to
another committed transaction.
Occurs when new rows are inserted by another transaction, affecting query results.
3. Concurrency Control
Techniques
Before reading or writing data, a transaction must acquire a lock. Other transactions
must wait until the lock is released.
Advantages
Simple to understand
Ensures isolation
Disadvantages
Deadlock possibility
Reduced concurrency
Performance overhead
Phases
1.
Growing Phase
2.
o
o
3.
Shrinking Phase
4.
o
o
Explanation
Advantages
Ensures consistency
Disadvantages
Blocking delays
Each transaction is assigned a unique timestamp, and operations are ordered based
on timestamps.
Explanation
Advantages
No deadlocks
High concurrency
Disadvantages
Frequent rollbacks
Assumes conflicts are rare and checks for conflicts only at commit time.
Phases
1.
Read Phase
2.
3.
Validation Phase
4.
5.
Write Phase
6.
Advantages
No locking overhead
Disadvantages
4. Comparison of Concurrency
Control Techniques
Techniq Deadlo Performa
Use Case
ue ck nce
Lock-
Yes Medium Traditional DBs
Based
Banking
2PL Yes Medium
Systems
Timestam Real-Time
No High
p Systems
Optimisti Web
No Very High
c Applications
5. Importance of
Transactional Processing &
Concurrency Control
6. Summary
Expand each concurrency technique into even longer 20+ line answers
Perfect! 🔥
I’ll now expand EACH concurrency control technique into detailed, exam-ready
20+ line notes, with advantages, disadvantages, examples, and diagrams
explained in text so you can directly write them in a long question.
CONCURRENCY CONTROL
TECHNIQUES – DETAILED
NOTES
1. Lock-Based Concurrency Control
1.1 Definition
Multiple transactions can acquire a shared lock on the same item at the same
time.
Prevents other transactions from writing to the data until all shared locks are
released.
Example:
Two transactions reading the same bank account balance simultaneously – both can
acquire S-Lock without conflict.
Prevents all other transactions from reading or writing until the lock is
released.
Example:
A transaction updating account balance gets X-Lock; all other transactions wait until
it finishes.
S-Lock X-Lock
Lock Type
Request Request
S-Lock
Allowed Not Allowed
held
X-Lock
Not Allowed Not Allowed
held
1.
2.
3.
Shrinking Phase: Transaction releases locks and cannot acquire any new
locks.
4.
Example:
A transfer transaction acquires locks on both accounts in the growing phase and
releases them after updating balances.
1.5 Advantages
1.
2.
3.
4.
5.
6.
7.
8.
1.6 Disadvantages
1.
2.
3.
4.
5.
6.
7.
8.
Inventory systems
2. Timestamp-Based Concurrency
Control
2.1 Definition
When a transaction wants to read or write, the DBMS compares its timestamp
with the timestamps of other transactions.
Example:
If T2 has already read old data, T2 may be rolled back to maintain timestamp
order.
2.3 Advantages
1.
2.
3.
4.
5.
6.
7.
8.
2.4 Disadvantages
1.
2.
3.
Newer transactions may experience starvation if older transactions keep
coming.
4.
5.
6.
7.
8.
Read Phase:
2.
3.
Validation Phase:
4.
5.
Write Phase:
6.
o
o
3.3 Advantages
1.
4.
5.
6.
7.
8.
3.4 Disadvantages
1.
2.
3.
4.
5.
6.
7.
8.
Online stores where users rarely update the same product simultaneously.
MVCC maintains multiple versions of each data item to allow readers and writers to
access data without blocking each other. Readers can see a consistent snapshot of
the database.
Example:
4.3 Advantages
1.
2.
3.
4.
5.
6.
7.
8.
4.4 Disadvantages
1.
2.
3.
6.
7.
8.
Definitions
1.
4.
5.
6.
7.
8.
1.
2.
3.
Shadow Paging
4.
5.
Log-Based Recovery
6.
3.3 Advantages
1.
2.
3.
4.
5.
6.
3.4 Disadvantages
1.
2.
3.
Cannot recover from system crash before commit unless logs are maintained.
4.
5.
6.
3.5 Example
Only after commit are the new balances written to the disk.
Immediate update writes changes to the database as soon as they are performed,
even before the transaction commits.
Requires a log file to undo uncommitted transactions if a failure occurs.
4.3 Advantages
1.
2.
3.
4.
5.
6.
4.4 Disadvantages
1.
2.
3.
4.
5.
6.
4.5 Example
If the system crashes mid-transaction, the log is used to undo the update for
consistency.
1.
2.
3.
Redo Log: Stores new values to redo committed transactions after failure.
4.
5.
Undo/Redo Log: Maintains both old and new values for complete recovery.
6.
1.
Each transaction operation is written to the log before actual database update
(Write-Ahead Logging).
2.
3.
During recovery:
4.
o
o
o
Redo all committed transactions that may not have been written to
disk.
5.4 Advantages
1.
2.
3.
4.
5.
6.
7.
8.
5.5 Disadvantages
1.
2.
3.
6.
5.6 Example
o
o
o
o
If a crash occurs, DBMS uses logs to undo uncommitted changes and redo
committed changes.
6. Shadow Paging
6.1 Definition
1.
Current pages
2.
3.
4.
No undo/redo logs are used; recovery simply switches back to shadow pages on
failure.
6.3 Advantages
1.
2.
3.
6.
6.4 Disadvantages
1.
2.
3.
4.
5.
6.
6.5 Example
7.2 Importance
Ensures durability
4.
5.
6.
7.
8.
9.
10.
9. Disadvantages / Limitations
1.
2.
3.
Recovery from large failures may take long time, affecting availability.
4.
5.
6.
7.
8.
10. Summary (Exam-Perfect)
Recovery techniques in DBMS are essential to ensure that databases remain
consistent and reliable even in the presence of failures. Techniques like deferred
update, immediate update, log-based recovery, and shadow paging provide
different trade-offs between performance, storage overhead, and complexity. Log-
based recovery is widely used in real-world systems because it allows undo and redo
operations, supporting full ACID compliance. Recovery mechanisms, coordinated by
the Recovery Manager, are vital in all advanced DBMS environments, ensuring
durable, reliable, and safe transactional processing.
Perfect! Let’s create exam-ready, highly detailed notes on Query Processing and
Optimization for Advanced Database Management Systems. I’ll structure it with
sub-points, examples, advantages, disadvantages, so each section is long-answer
friendly (20+ lines per main point).
Query processing is the set of steps through which a database management system
(DBMS) executes a query written in high-level languages such as SQL, and
produces the desired result efficiently.
1.4 Example
SQL query:
SELECT name, salary FROM employees WHERE department = 'IT' AND salary
> 50000;
Query processing converts this high-level SQL into low-level operations, like table
scans, index searches, and joins, to produce the result efficiently.
Definition: The DBMS parses the SQL query to check syntax correctness and
translates it into an internal form.
Details:
1.
2.
3.
4.
5.
Semantic Analysis: Ensures tables, columns, and operations exist and are
valid.
6.
7.
8.
Example:
Advantages:
Disadvantages:
Complex queries may take time to parse and translate.
Details:
Example:
Two queries:
1.
2.
3.
4.
Advantages:
Disadvantages:
Details:
Table scan, index scan, nested-loop join, sort-merge join, hash join.
Creates a query execution tree to represent operations.
Example:
Execution plan:
1.
2.
3.
4.
5.
6.
Advantages:
Disadvantages:
2.4 Query Execution
Definition: Actual execution of the query using the chosen execution plan.
Details:
Example:
Nested-loop join of students and departments table: iterates over one table,
searches matching rows in another.
Advantages:
Disadvantages:
Definition: Uses rules of thumb to reduce query cost without evaluating all plans.
Rules / Sub-points:
1.
2.
3.
4.
5.
6.
Example:
Query: σ_salary>50000(π_name,salary(employees))
Advantages:
Disadvantages:
Definition: Evaluates multiple execution plans and selects the one with minimum
estimated cost.
1.
2.
3.
4.
5.
6.
7.
8.
Steps:
1.
2.
3.
4.
5.
6.
Example:
o
o
Advantages:
Scales well for large databases.
Disadvantages:
Techniques:
1.
2.
3.
Dynamic Programming: Evaluates all possible join orders for optimal cost.
4.
5.
6.
Advantages:
Improves query response time.
Disadvantages:
Definition: Use of indexes to quickly access data instead of scanning full tables.
Types of Indexes:
B-Tree
Hash index
Clustered/Non-clustered
Advantages:
Disadvantages:
Advantages:
Disadvantages:
Storage overhead.
Key goal: reduce I/O, CPU, and memory usage while providing correct
results.
1.
2.
3.
4.
1. Introduction
1.1 Definition
1.2 Importance
Ensures queries are executed efficiently to minimize CPU, memory, and I/O
cost.
Definition: The DBMS checks the query for correctness and converts it into an
internal form (relational algebra) for optimization.
Sub-Points:
1.
2.
3.
4.
5.
6.
7.
8.
Example:
Internal representation:
π_name(σ_marks>80(students))
Advantages:
Disadvantages:
Definition: Query optimization selects the most efficient execution plan from many
possible plans using heuristic or cost-based methods.
Sub-Points:
1.
2.
3.
4.
5.
Join Order Optimization – Determines the best order for joining tables.
6.
7.
8.
Example:
Query joining employees and departments:
Hash join = 200 I/Os → optimizer chooses hash join
Advantages:
Disadvantages:
Sub-Points:
1.
2.
3.
4.
5.
6.
Example:
SQL: SELECT name FROM students WHERE marks > 80
Execution plan:
1.
2.
3.
4.
5.
Project name
6.
Advantages:
Disadvantages:
Definition: Executes the physical plan and retrieves the results by interacting with
the storage manager.
Sub-Points:
1.
2.
3.
4.
5.
6.
7.
8.
Example:
Nested-loop join: iterates over one table, searches for matching rows in the
other table.
Hash join: builds hash table of smaller relation, probes larger relation.
Advantages:
Disadvantages:
Understanding stages helps explain why queries may be slow and how
optimization works.
Diagrams (query tree or execution tree) can earn extra marks in long-answer
questions.
💡 Next Step: I can make ASCII/text-based diagrams for Query Processing Stages
(Parse → Optimize → Plan → Execute) with examples included, which are perfect
for exams and long-answer visuals.
1. Introduction
1.1 Definition
Query optimization is the process of selecting the most efficient execution plan
from multiple possible alternatives for a given query. It reduces CPU, I/O, and
memory usage, ensures faster response time, and supports large-scale multi-user
databases.
1.2 Importance
Definition: DBMS parses the SQL query to ensure syntax and semantics
correctness.
Sub-points:
1.
2.
3.
4.
5.
Semantic Analysis: Ensures table and column names exist and data types
match.
6.
7.
8.
Example:
Sub-points:
1.
2.
3.
4.
5.
6.
Example:
Original: σ_age>20(σ_age<30(students))
Simplified: σ_20<age<30(students)
Advantages:
Simplifies further cost estimation and plan selection.
Disadvantages:
Definition: DBMS generates all possible logical plans for executing the query.
Sub-points:
1.
2.
3.
4.
5.
6.
Example:
Possible plans:
1.
(A ⋈ B) ⋈ C
2.
3.
A ⋈ (B ⋈ C)
4.
Definition: Assign a cost to each execution plan using parameters like CPU, I/O,
memory, and network usage.
Sub-points:
1.
2.
3.
4.
5.
6.
7.
8.
Example:
Advantages:
Disadvantages:
Definition: Converts the logical plan into a physical execution plan using available
algorithms and access paths.
Sub-points:
1.
2.
Table scan
o
o
Index scan
o
o
Nested-loop join
o
o
Sort-merge join
o
o
Hash join
3.
4.
5.
6.
Example:
Logical plan: (A ⋈ B) ⋈ C
Physical plan: Nested-loop join for (A ⋈ B), Hash join for result with C
Advantages:
Disadvantages:
Sub-points:
1.
2.
3.
4.
5.
6.
Example:
Advantages:
Improves throughput in multi-user systems.
Disadvantages:
Definition: Execute the physical plan on the database and return results.
Sub-points:
1.
2.
3.
4.
5.
6.
Example:
Advantages:
Disadvantages:
4.
5.
6.
7.
8.
9.
10.
5. Disadvantages / Limitations
1.
2.
3.
4.
5.
Complex queries with many joins may have exponentially many plans.
6.
7.
8.
✅ These notes are now fully detailed, long-answer ready, with:
Step-by-step stages
If you want, I can next create a fully combined flowchart diagram showing both
Query Processing and Query Optimization together, which is perfect for high
marks in exams.