There are complex data structures in the database systems. Developers use data abstraction to increase the efficiency of the system in retrieving of data and reducing the complexity of these structures for users. Data abstraction means hiding details from users that are not relevant to them. The process helps simplify complex data structures. Data abstraction has three levels: physical, logical, and view.
Three Levels of Data Abstraction:
1. Physical
The lowest level is physical, and it tells how storing of data takes place in memory. It uses access methods, including random or sequential access and file organization methods including B+ trees or hashing. While designing the database, the factors required are memory size and the number of times it records. For example, if we need to store the details of a student in the university database. Then the memory used and blocks of storage are not shown to the user.
2. Logical
This is the intermediate level and consists of the information in the form of tables stored in the database. The information available at the view level is unknown at this level. Here simpler structures are used to store relationship among data entities. Also, we can store student attributes in an institution and his relationship with other entities.
3. View
The highest level is the view, and at this level, only some part of the database is visible to the users. The user gets the ease of access to use the database at this level. Data is present in the form of rows and columns for the users. The same database can be viewed multiple times, but storage and implementation details are kept hidden from the user.
Data abstraction is used to achieve data independence, which further saves the time and cost in cases of modification and alteration of the database.
These levels of abstraction give rise to two levels of data independence, namely physical level data independence, and logical level data independence.
Two Levels of Data Independence
Physical Level of Data Independence
This level of data independence means the modification of physical schema without making any alterations in the logical schema, which is done for optimization. For example, if there is a change in the size of the storage of the database, there will be no effect on the conceptual structure of the database. The modifications may include the utilization of new storage devices, change of data structures and alterations in indexes.
Logical Level of Data Independence
This level means the ability to modify logical schema without any alterations to the external schema. Here if the conceptual view of the data is altered or changed, the user view of the data does not get affected. The changes or modifications may include:
- Inserting or deleting an attribute from the database.
- Alterations in entities of table structures.
- Changes in the relationships to the logical schema.
So, the data abstraction helps to simplify the complex structures of the database. It also helps in saving cost and time in case of modifications and alterations in the database.