DBMS
Database
Almost always more than one database are used, but it is import to understand which database is best to perform what particular task. There are different functionalities and features involved while designing a system, and our focus remains to use the best suited database for a particular use case
Database is a collection of related data which represents some aspect of the real world
DBMS, Database Management System
A software for storing and retrieving users' data
DBMS Provides security and removes redundancy
End-Users, Application Programmers, and Database Administrators are users who access a DBMS
DBMS serves an efficient handler to balance the needs of multiple applications using the same data
SQL vs NoSQL Database
SQL stands for Structured Query Language, also know as relational database, while NoSQL is known as non-relational database.
However, there are limitations on speed and scaling when it comes to massive high availability data stores. So we bargain availability for speed and scaling purpose and therefore end-up using NoSQL (non relational database)
For example, Google and Amazon have terabytes of data stored in big data centres. Querying and inserting is not performance efficient in these scenarios because of the blocking/schema/transaction nature of the RDBMs. That's the reason they have implemented their own databases (actually, key-value stores) for massive performance gain and scalability.
Database Selection: Questions to be Answered
How much data do you expect to store when the application is mature?
How many users do you expect to handle simultaneously at peak load?
What availability, scalability, latency, throughput, and data consistency does your application need?
Latency: Response time for single request
Throughput: Number of transactions per sec
How often will your database schema change?
What is the geographic distribution of your user population?
What is the natural “shape” of your data?
Does your application need online transaction processing (OLTP), analytic queries (OLAP), or both?
What ratio of reads to writes do you expect in production?
Do you need geographic queries and/or full-text queries?
What are your preferred programming languages?
Do you have a budget? If so, will it cover licenses and support contracts?
Are there legal restrictions on your data storage?
Choosing a Database
No database is perfect, serving all the purposes; there are multiple types of database, and every database comes with its own advantages and disadvantages.
In general, CAP (Consistency, Availability and Partition-Tolerance) theorem is used as a deciding factor for choosing a database.
CAP
Consistency: Every read receives most recent write or an error
Availability: Every request receives a (non-error) response, without guarantee that it contains the most recent write
Partition-Tolerance: The system continues to operate an arbitrary number of messages being dropped (or delayed) by the network between the nodes
No database at present satisfies all the CAP properties; every database satisfies just two of the three properties. Therefore decision to chose a database comes from the requirements and use-case.
If everything written is complicated for you, here is another way to look at it:
Atomicity: Operations are classified into atoms, and that whole atom execute or none of it, not possible to execute a part of it (for example bank transaction), relational database to be used for the purpose
Scaling (Vertical or Horizontal): NoSQL is preferred for horizontal scaling, for vertical scaling SQL is fine
Speed: if speed is a priority over ACID, need to use NoSQL (document-based is preferred)
This flow diagram will further help in the understanding, which database to chose:
Reference for Further Reading
Last updated
Was this helpful?