DBMS Core Series: 1.1

Dev GuptaDev Gupta
6 min read

Introduction


Databases power our digital world, and at the heart of managing them efficiently is the Database Management System (DBMS). In this blog, we’ll break down essential DBMS concepts and common challenges that every developer should know.

Basics Terms

Data

1⃣
A set of values of qualitative and quantitative values about one or more observations and a collection of raw and unorganized facts.Any facts and figures about an entity is called as Data

Information

1⃣
Information is the data processed in a meaningful form. Information is the result of processing, organizing, and analyzing data in a meaningful way. Information gives context to the raw data, turning it into something useful.
2⃣
Information is essentially processed data that has been contextualized for interpretation. The transformation of data into information often involves statistical analysis, calculations, or filtering, which adds clarity and purpose to the raw data.

Database

1⃣
A database is an organized collection of data that is stored and accessed electronically. In simpler terms, a database is like a digital filing system, where data is stored systematically to allow easy retrieval, management, and updating. Databases serve as the backbone of countless modern applications, from financial systems to social media platforms.

DBMS (Database Management System)

1⃣
The database management system (DBMS) is the software that interacts with end users, applications, and the database itself to capture and analyze the data. Essentially, the DBMS is the intermediary between the raw data stored in the database and the applications or users who need to access it.
2⃣
A DBMS provides users with tools to add, delete, modify, and query the data in a structured and organized way. It ensures data consistency, security, and integrity while allowing concurrent access to multiple users.

In summary all these terms can be summed up into one line as

Data: Raw facts (e.g., "35°C").
Information: Processed data with context (e.g., "Temperature in Nagpur is 35°C").
Database: Organized data storage.
DBMS: Software managing and interacting with databases.


Understanding File Systems & Transactions

💡
In database management, understanding the intricacies of how data is handled is key to ensuring data integrity and efficient performance. Let’s explore the problems with traditional file systems, delve into the concept of transactions, and understand the ACID properties that maintain consistency in databases.

Problems with File Systems

💡
Before the advent of modern Database Management Systems (DBMS), file systems were used to manage data. However, file systems have several limitations that can cause serious issues in data management:
  • Data Redundancy and Inconsistency: In file systems, the same data can be duplicated across different files. For example, if an employee's contact information is stored in two different spreadsheets, one file could be updated while the other remains outdated, leading to confusion about the correct information.

  • Difficulty in Accessing Data: Retrieving specific data from file systems often requires assistance from IT specialists or complex programming, making it time-consuming. For instance, you may need to wait for an IT team to generate a report that could be easily retrieved in a DBMS

  • Data Isolation: In file systems, data might be stored in various formats or locations, making it difficult to combine information. For example, customer profiles may be stored in one system while order histories are stored in another, making it hard to view a comprehensive customer profile.

  • Integrity Problems: Integrity issues arise when data is updated in one location but not in another. For example, if a customer changes their address on a website, and this update is not reflected throughout all systems, old addresses may still appear in some areas.

  • Atomicity Problems: A file system might only partially execute operations. For instance, in a banking transaction, money might be deducted from one account but not credited to another due to a failure, resulting in an incomplete transaction.

  • Concurrent Access Anomalies: File systems can encounter issues when multiple users try to access and update data simultaneously. For example, two users trying to book the last ticket for a flight at the same time might both get confirmation, even though only one seat is available.

Transactions in DBMS

💡
To address many of the issues presented by file systems, DBMSs use transactions to manage data operations. A transaction is a sequence of one or more operations executed as a single logical unit of work. It is designed to ensure that data is processed reliably and that the database remains in a consistent state.

Why We Study Transactions

According to the general computation principle (operating system), we may have a partially executed program, as the level of atomicity is instruction i.e. either an instruction is executed completely or not . But in the DBMS view, the user performs a logical work(operation) which is always atomic i.e. either operation is executed or not executed, there is no concept like partial execution.

What is a Transaction?

A transaction is a bundle of logically related instructions that perform a single logical unit of work. In DBMS, it includes two basic operations:

  • READ (X): Accessing data from the database.

  • WRITE (X): Writing data back to the database after modifications.

For example, consider the following transaction for transferring 100 units from Account A to Account B:

T1:
Read(A)
A = A - 100
Write(A)
Read(B)
B = B + 100
Write(B)

In this transaction, the database ensures that both accounts remain balanced and consistent after the transaction, preventing partial execution from corrupting the data.

Transaction States

A transaction passes through various states during its execution:

  1. Active: The transaction is in progress and performing operations.

  2. Partially Committed: The transaction has completed its operations, but changes are still in memory and may be lost if not written to disk.

  3. Failed: The transaction encounters an error or issue and cannot proceed.

  4. Aborted: The transaction is rolled back, restoring the database to its previous state before the transaction began.

  5. Committed: The transaction completes, and its changes are permanently stored in the database.


Conclusion

💡
By using transactions, DBMSs ensure that data remains consistent, reliable, and protected from failure or corruption, even in complex multi-user environments. Understanding these core concepts is essential for maintaining the integrity and efficiency of modern databases.In next chapter we will study more about new terms starting with the ACID properties.
0
Subscribe to my newsletter

Read articles from Dev Gupta directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Dev Gupta
Dev Gupta