Physical Data independence and Logical Data independence in DBMS

Data Independence in DBMS

Data Independence in DBMS is useful to modify the Database schema at one level of a database system and it will not change the Database schema at the succeeding higher level. Data independence help to keep data separate/independent from all programs that are using the database.

Types of Data Independence

There are two types of data independence

  1. Physical data independence
  2. Logical data independence.

Levels of Database

The database 3 levels  below

  1. Physical/Internal
  2. Conceptual
  3. External

Consider an example of a database for an organization and let’s see that how it will implement.

Type of Schema Implementation
External Schema View 1: salary info(salaryid:int, Pay_Scale:string)

View 2:Employeeinfo(id:int. name:string)

Conceptual Shema Employee(id: int, name: string, login: string, age: integer) 

salary(id: int, Pay_Scale:string, credits:integer) 

Physical Schema
  • The Relations are stored in the form of unordered files.
  • Index on the first column of Employee.

Physical Data Independence

“Physical data independence separates the conceptual levels from the internal/physical levels of the database”.

Physical data independence permits to delivery of a logical description of the database without the need to specify the physical structures. If we want to achieve physical data independence, then it’s easy to achieve as compared to Logical Data Independence.

Examples of Physical Data Independence

Due to Physical independence, any of the below changes will not affect the conceptual layer.

  • If we use a new storage device for the database, then it will not affect the conceptual layer.
  • When we update the file organization technique in the Database, then it will not affect the conceptual layer.
  • Switching to different data structures will not affect the conceptual layer.
  • If we change the access method will not affect the conceptual layer.
  • If we Modify the indexes, then it will not affect the conceptual layer.
  • If we change the hashing algorithms or compression techniques, then it will not affect the conceptual layer.
  • If we change the Location of the Database from say C drive to E Drive, then it will not affect the conceptual layer.

Logical Data Independence in DBMS

Logical Data Independence means to change the conceptual scheme without changing the External API or programs or External views.

Its very difficult to achieve logical data independence as compared to Physical Data independence.

Examples of Logical Data Independence

If we want to Add/ Delete/modify a new attribute, entity or relationship in the databse, then it is workable without a rewrite of existing application programs

Difference between Physical Data Independence VS Logical Data Independence

Physical Data Independence

Logical Data Independence

Examples of Physical data independence are

  1. hashing algorithms
  2. change in compression techniques
  3. storage devices, etc
Examples of Logical data independence are

  1. Add a new attribute
  2. Modify an attribute
  3. Delete an attribute
Physical data independence is easy to retrieve. The retrieving of data is difficult as it mainly depends on the logical structure of data.
A change in the physical level usually does not demand change at the Application program level. Changes are required in the Application program if new fields are added or deleted from the database.
Primarily concerned with the data storage. Primarily concerned with the structure or changing the data definition.
Physical data independence is concerned with internal schema Concerned with conceptual schema
Changes made at the internal levels may or may not be desirable to improve the performance of the structure. Changes at the logical levels are important whenever the logical structures of the database are changed.