Data independence is a property of a database management system (DBMS). It lets us change the schema at one level of the DBMS without affecting the schema at the next, higher level. This enables us to keep the data and the programs separate.
There are two types of data independence: physical, and logical.
We use the three-schema architecture to implement the data independence property, as shown below:
In this architecture, we define the schema at three different levels:
This is the part of the database that the user has a specific interest in. This level creates different views for the user. For instance, a user can view the course and section details simultaneously, without worrying about the exact process running at the back end.
This level defines the database structure at this level for a community of users. It explains data types, entities, and relationships. However, it hides intricate details, such as the physical storage structure, from the users.
This level defines how the data is physically stored on storage devices, such as a hard disk. It provides the complete details of physical storage and access paths.
Physical data independence separates the logical schema from the physical schema. It allows us to change the lowest level of the DBMS, the physical schema, without changing the logical or external levels. For instance, we can change the location of the database for faster access without affecting the logical or external levels.
Physical data independence is desirable for multiple reasons:
DBMS uses modified physical to logical layer mapping to preserve the property of physical data independence. The DBMS automatically performs the mapping itself. It absorbs the all changes that we make to the physical layer.
Physical data independence primarily concerns data storage and the internal schema. Here are some examples of the changes we can make at this level:
Note: As long as the data is not affected, any changes made to the physical schema layer do not affect the higher schema layers.