Hierarchical Database Model
In the hierarchical database model data is organized in a tree like structure. Each data has a single parent or a root but each parent or root can have many children records. Records which share same parent or root is known as siblings. Siblings are also sorted in a predefined order. This model is mainly ideal for describing real world relationships where there is a established hierarchy. In this model we can see one-to-one and one-to-many relationships but not many-to-many relationships. This model was designed for mainframe DBMS.
Physical order of the records stored in the storage was depended on this hierarchical structure.
Following is a example of hierarchical database model.
Advantages of Hierarchical database model
- Higher performance
- The DBMS can navigate among the records in the database very fast because of the hierarchical relationship among the records. The DBMS doesn’t need to search for an index to find the next record. It just have to follow another pointer in the parent record. This is true for both parent record to child record navigation and sibling record to sibling record navigation.
- Easily understandable
- Anyone can easily understand tree like structure of the hierarchical database model. Relationship among the records are clearly visible and understandable for both technical and non technical users.
Disadvantages of Hierarchical database model
- Redundant records
- As this model doesn’t have many-to-many relationships redundant records have to be created to store data
- Difficult and time consuming to design
- Specially trained experts are need to design the database to store the required data due to rigid structure of the database.
Network Database Model
Network model is an model created based on hierarchical model. But Network model allow for many-to-many relationships for records where in hierarchical model it was not possible. Therefore in this model a record can have multiple children records and a child record can have multiple parent records. This allow to create complex relationships between records.
This model was invented by Charles Bachman. In 1969 it was developed in to a standard specification by Conference on Data System Languages Consortium. Revised version was published in 1971 and it was used as basis for most of the implementations.
Following is an example for a network database model.
Advantages of Network Model
- Easy to understand
- Just like hierarchical database model, Network Database Model is also easy to understand by a technical or non technical person.
- Data Integrity
- In the network model a member cannot exist without an owner. Therefore integrity of data is preserved.
- Structure is not rigid as in hierarchical model.
- Easy to create complex databases
- Easy to model any relationship due to existence of one-to-one, one-to-many and many-to-many relationships
- Ease of Access
- Due to existence of one-to-one, one-to-many and many-to-many relationships DBMS can access any table record very easily
Disadvantages of Network model
- No structural independence
- When Network database model is used changing the structure of the database is very difficult.
- Operation Anomalies
- When we insert, delete or update a records large number of pointers need to be adjusted.
- Records in the network database model is maintained using pointers. Therefore structure of the database is very complex.
Relational Database Model
Relational Database Model which is first proposed by Edgar F. Codd, is one of the most popular database models used. In this model data is represented as tuples which are then grouped into relations.
The main purpose of this model is to implement a declarative method for specifying data and queries. Here user can directly state what information the database contain and what are the information they need from it. Then the DBMS will automatically create data structures to store data and retrieval procedures to answer the queries by the user.
Most of the relational databases use SQL (Structured Query Language) as the data definition and query language.
Advantages of Relational Model
- Ease of use
- Can query all the table to find exact data
- Can scale easily
- Can access, update and share information among many users
- Higher security
- Data Independence
Disadvantages of Relational Model
- Require powerful hardware
- Due to ease of design users may create poorly designed databases
Object Oriented Database Model
In the object oriented database model is defined as a collection of objects. It is a combination of capabilities of databases and object oriented programming. Objects can be created and named at one point and the can be called or referenced later same as in Object Oriented Programming.
Advantages of Object Oriented Model
- Improved Performance
- From various benchmarks carried out on both object oriented databases and relational databases, object oriented databases shows average of 30 folds improvement over relational databases.
- Long duration transactions are supported
- In object oriented database model there is a different protocol to handle long duration transactions.
- Schema evolution supported
- There is a very tight coupling between data and applications. This helps in schema evolution.
- Expressive Query Language
- Most common way to access data in Object Oriented Database is navigational access. It is more suitable for recursive queries, explosions etc.
- Can handle variety of data types
- Object oriented database can store data such as pictures, audio, text, numbers etc.
- Due to Object Oriented properties such as Inheritance, in this database model common properties can be extracted to form a superclass. This will reduce the redundancy of the database.
- Furthermore objects can be reused which helps in faster development and easier maintenance
- Better Modeling Capabilities
- In this model we can model real world scenarios more accurately. Objects can encapsulate states and behaviours which can be seen in real world scenarios. These objects can store all the relationships it has with other objects, creating complex objects which other database models will struggle to do.
Disadvantages of Object Oriented Model
- No universal data model
- There is no universally agreed data model for object oriented databases. Most of the existing models don’t have a solid theoretical foundation.
- Lack of experience.
- Use of Object Oriented databases is relatively new and limited. Therefore there is a lack of experience. Furthermore this model is still focused on programmers not on end users.
- Lack of standard
- There is no standard query language for object oriented databases
- High Complexity
- Due to extra functionalities provided by object oriented databases it becomes more complex than traditional databases
NoSQL Database Model
NoSQL databases provide a way for retrieval and storage of data which are not in tabular relational fashion. While this type of database exist since 1960s they only got popular in early 21st century. These type of databases are more popular in big data and real time web applications.
There are basically four categories of NoSQL databases
- Key Value
Advantages of NoSQL database model
- Integrated Caching
- Many NoSQL databases have excellent integrated caching capabilities. This will help in increasing read and write performance significantly.
- Auto Sharding
- When a database grow large it is more effective to scale it horizontally than vertically. But relational databases don’t support horizontal scaling. To make it scale horizontally lot of extra work is required. Unlike relational databases NoSQL databases support auto sharding and able to scale horizontally without any work from the application.
- Dynamic Schemas
- In relational database models we need to pre define the schema before we add data into the database. But in NoSQL databases we can add data without predefined schema.
- Many of the NoSQL databases are able to automatically replicate to maintain availability. Some of the sophisticated NoSQL databases are able to self heal and automatically failover and recover
Disadvantages of NoSQL database model
- Less mature
- Unlike relational databases NoSQL database models are in the early stages of production.
- Less support
- If the database of an application fails there should be support in a timely manner. This is not yet available for NoSQL databases
- No advance expertise
- As NoSQL databases are less mature experts in the field are hard to comeby.