What is a Database Management System and how is it different from a File System?

Traditionally, the file system was used for data management. Data was stored in files and users access those files directly by going at the location of the file physically. But things become harder when the amount of data stored in the files get increased. How will you search a file from millions of files available to you? Will you go one by one to each file and search for your file? No. It is very tedious and next to impossible process. Also, when we are having some online or digital data, then we store our data in some database and particular software is used to handle the database(read more about database and DBMS from here). So, there is a lot of difference between the traditional file system and the Database Management System. In this blog, we will see the difference between these two. So, let's get started.

File System

The file system is a traditional way of storing data where the user saves the file manually at any location. It is an easy way to store texts, audio, video but here security is a major concern. The options which are given by the operating system in the name of security are very limited. Only options which we have are locks and hidden files. Also, these files are very hard to maintain and users manually go to these locations to access these files. So, there were many problems with this file system. Let's now see in details these problems:

Problems with the traditional file system

  • Data Redundancy: In a file system, there are high chances of data duplicity. Same data may be stored multiple times. Example: We have an employee who is working on two projects. So, we might end up storing the information of that employee twice, which may lead to increased storage.
  • Data Inconsistency: Data redundancy is the main cause of data inconsistency. In the above example, let us suppose we need to change the mobile number of the employee and we change it in one place but we forget to edit it at another place. This would lead to data inconsistency because in future if we refer to this data we would not know which one is correct and which one is wrong. For having the correct data you need to store the same data at both places and this is a very bad thing to do.
  • Low Security: In the file system, anyone having access to the files can see all the data. There is no role-based access control i.e there is no method by which some authenticated people would have access to all data and others would have access to only limited data.
  • Attributes for accessing file: Metadata means data about data. If we want to access any file in the file system then we require the name of the file, its address, permissions etc. All these are not easy to remember and also not user-friendly. Example: If we need to access any file, we need to provide its full location like Desktop/AfterAcademy/DBMS/FileSystemVsDBMS/.
  • No Concurrent Access: If multiple users access the data at the same time then there might be some data inconsistency.

These are some of the drawbacks of the file system that are removed by the Database Management System. Let's see how.

Database Management System

As we have seen above that file system had many problems. So, DBMS came as a saviour and resolved these problems. As the main problem with the file system was security, DBMS is an effective way to store the data when security is the major concern of the user. DBMS stores the data in the form of interrelated tables and files. This reduces the redundancy of data as the data here is centralized(you can read more about the characteristics of DBMS from here). Also, access to data is very fast when we use DBMS. It provides us with an interface or a tool, to perform various operations like:

  • creating the database
  • manipulating the database
  • storing and retrieving the data from the database
  • deleting data from the database, etc.

Advantage of using DBMS over the traditional file system

  • Fast Data Access: The data response time increases in DBMS. Example: If we search for any train in IRCTC then we get results about that train only in a fraction of seconds. But the file system would have given us the entire file. Such a file size is large hence its access time will also be more.
  • Minimized Data Redundancy: DBMS has different constraints like primary key constraints which helps in ensuring that we store only unique data in our database i.e. same data can't be stored in more than one places.
  • Data Consistency: Since DBMS solves the problem of data redundancy, the problem of data consistency is automatically solved. All you need to do is just change the data at one place and you are good to go.
  • Security: We have role-based access control in DBMS. Each user has a different set of access thus the data is secured from problems like data leaks, misuse of data etc. Example: In a university system the access is restricted according to the user. The teachers, students, accounts manager etc. all have different access i.e. the accounts manager will have the access to all the data related to the accounts and the teacher will not be allowed to view the accounts data.
  • No attributes for accessing the data: Here, we don't need to know the location of the file. The user makes a request from any web application or app and the server responds accordingly. Example: If we want to know the fastest train between two stations we make a request on IRCTC and we get the result and we don't need to know where the data is stored.
  • Concurrent Access: Multiple users can access the database at the same time when we are using the Database Management System.

These are some of the advantages of using Database Management System over File System.

This is all about the file system and DBMS. Hope you learned something new today.

Do share this blog with your friends to spread the knowledge. Visit our YouTube channel for more content. You can read more blogs from here.

Keep Learning :)

Team AfterAcademy!