0
0
DBMS Theoryknowledge~5 mins

Why DBMS replaced file-based systems - Performance Analysis

Choose your learning style9 modes available
Time Complexity: Why DBMS replaced file-based systems
O(n)
Understanding Time Complexity

We want to understand how the time to access and manage data changes when using file-based systems versus DBMS.

How does the system handle more data and more users efficiently?

Scenario Under Consideration

Analyze the time complexity of searching for a record in a file-based system versus a DBMS.

-- File-based system: linear search
OPEN file;
FOR each record IN file LOOP
  IF record matches THEN
    RETURN record;
  END IF;
END LOOP;
CLOSE file;

-- DBMS: indexed search
SELECT * FROM table WHERE key = value;

The file-based system searches records one by one, while DBMS uses indexes to find data faster.

Identify Repeating Operations

Look at what repeats when searching data.

  • Primary operation: Checking each record in the file one by one (file-based).
  • How many times: As many as the number of records until the match is found or file ends.
  • DBMS operation: Using an index to jump directly to the record.
  • How many times: Very few steps, depends on index structure, not total records.
How Execution Grows With Input

As the number of records grows, the file-based search takes longer because it checks more records.

Input Size (n)Approx. Operations (File-based)
10Up to 10 checks
100Up to 100 checks
1000Up to 1000 checks

Pattern observation: The time grows directly with the number of records.

For DBMS, the number of steps grows much slower, often like the height of a tree, not the total records.

Final Time Complexity

Time Complexity: O(n) for file-based search

This means the time to find data grows directly with the number of records in the file.

Common Mistake

[X] Wrong: "Searching a file is always fast because computers are quick."

[OK] Correct: Even fast computers take longer if they must check every record one by one as data grows.

Interview Connect

Understanding how data access time grows helps you explain why DBMS are better for large data and multiple users.

This skill shows you can think about system efficiency, a key part of many tech discussions.

Self-Check

What if the file-based system used an index like a DBMS? How would the time complexity change?