In this article, we will learn what is data independence in DBMS. We will try to cover every concept of data independence in DBMS. Let’s get started with define data independence in DBMS and then deep dive into the explanations and examples.
What is Data Independence in DBMS?
Data independence refers to the capability of changing a DBMS’s schema definition at one level without changing it at the next higher level.
Let’s use an illustration to clarify data independence.
Why Do We Need Data Independence in DBMS?
A database system often stores a lot of data in addition to the information input by users. Data can be found and retrieved more easily since the system stores metadata about the data. It is difficult to change or update metadata once it has been recorded in a database. A database management system (DBMS) must, however, change as it expands in order to accommodate its customers’ demands. If all of the data were dependent, updating the schema or data would be a time-consuming and difficult operation.
It is set up in a tiered structure to handle the issue of updating metadata and ensure that altering data at one level has no impact on changing data at another. Although each piece of information is independent, they are all connected.
Data independence, therefore,therefore helps to keep data separate from the programs that use it.
Levels of Database
A review of Database Levels is necessary before learning about Data Independence. The graphic below illustrates the three tiers of the database.
- Physical/Internal
- Conceptual
- External
Think about a sample university database. This is how the implementation will seem at the various levels:
Type of Schema | Implementation |
---|---|
External Schema | View 1: Course info(cid:int,cname:string) View 2: studeninfo(id:int. name:string) |
Conceptual Schema | Students(id: int, name: string, login: string, age: integer) Courses(id: int, cname:string, credits:integer) Enrolled(id: int, grade:string) |
Physical Schema | Relations stored as unordered files. Index on the first column of Students. |
Types of Data Independence
There are two different forms of data independence in DBMS.
- Physical data independence
- Logical data independence.
Physical Data Independence
You can better distinguish between conceptual levels and internal/physical levels when there is physical data independence. It enables you to describe the database logically rather than having to detail its physical architecture. Physical data independence is simple to obtain in comparison to logical data independence.
Physical independence makes it simple to modify the actual hardware, which has an impact on the conceptual framework. Any modifications made would be incorporated into the conceptual and internal level mapping. The internal level of the database and subsequent transition from the conceptual level of the database to the internal level enable physical data independence.
Examples of changes under Physical Data Independence
Any of the adjustments below won’t have an impact on the conceptual layer because of their physical independence.
- Using a new storage device like Hard Drive or Magnetic Tapes
- Modifying the file organisation technique in the Database
- Switching to different data structures.
- Changing the access method.
- Modifying indexes.
- Changes to compression techniques or hashing algorithms.
- Change of Location of Database from say C drive to D Drive
Logical Data Independence
To modify the conceptual framework without changing the logical data is to have logical data independence.
- External views
- External API or programs
Any modification will be incorporated into the mapping between the conceptual and external levels.
Logical data independence is more difficult to acquire than physical data independence.
Examples of changes under Logical Data Independence
Because of logical independence, none of the changes below will have an impact on the external layer.
- Without rewriting current application scripts, it is feasible to add, modify, or remove a new attribute, entity, or relationship.
- two recordings are combined to form one.
- dividing a record already held into two or more records
Difference between Physical and Logical Data Independence
Logical Data Independence | Physical Data Independence |
---|---|
The major focus of logical data independence is on altering the definition or structure of the data. | mostly interested in data storage. |
It is challenging since data retrieval mostly depends on the logical organisation of the data. | It is easy to retrieve. |
Logical data independence is more challenging to accomplish than logical physical independence. | Physical data independence is simple to acquire compared to logical data independence. |
If new fields are added to the database or existing ones are removed, you must make modifications in the application software. | Typically, there is no requirement for change at the application program level when the physical level changes. |
Anytime the logical structures of the database are modified, there must be considerable modification at the logical levels. | It may or may not be necessary to make adjustments at the internal levels to enhance the structure’s performance. |
Concerned with conceptual schema | Concerned with internal schema |
Example: Add/Modify/Delete a new attribute | Example: change in compression techniques, hashing algorithms, storage devices, etc |
Importance of Data Independence
- Helps you to increase the data’s quality
- Database system upkeep costs decrease
- Standards enforcement and enhanced database security
- Application software data structures don’t need to be changed.
- Allowing developers to concentrate on the Database’s overall structure rather than worrying about the inside implementation
- It enables you to enhance a damaged or undivided state.
- Database inconsistency is greatly decreased.
- In order to enhance the system’s performance, simple physical changes must be made.
Summary
- In order to alter the database schema at one level of a database system without having to update the schema at the next higher level, a DBMS must have the property known as data independence.
- Physical and logical data independence are the two stages.
- Separating conceptual levels from internal/physical levels is made easier by physical data independence.
- To modify the conceptual framework without changing the logical data is to have logical data independence.
- Logical data independence is more difficult to acquire than physical data independence.
- Data Independent helps you to increase the data’s quality