What database to choose ?

Anup Singh
2 min readOct 2, 2022

--

Questions to ask yourself when choosing a database

  • How many people will use my application simultaneously?
  • What is my biggest preference: data security or application performance?
  • What are my other critical non-functional and business requirements?
  • Do I want to analyze my data or implement any advanced technologies in my application like machine learning or artificial intelligence?
  • Do I need to integrate my database with other solutions like business intelligence tools?

This isn’t a complete list of questions that can guide your whole database selection process, but they are enough to set you in the right direction in finding the best database to use.

SQL vs NoSQL database

SQL

If you are looking for all or most of the following points in your application then you can go for SQL database.

  • Ideal for storing structured data (credit card numbers, zip codes)
  • Security — Access permissions and privileges to access, select, insert or delete data.
  • Protection against data loss and data corruption [Thanks to ACID properties]
  • Perfect fit for financial, healthcare, and personal data
  • MySQL , PostgreSQL

Drawbacks

  • Doesn’t work efficiently with semi-structured or unstructured data.
  • Harder to share information when data structure becomes complex.
  • RDBs run on only one server so, in order to deal with a larger amount of data, you need to invest in costly physical equipment.

NoSQL

Go for NoSQL if these points sound good to you.

  • Your data is semi-structured or unstructured [Data from social media, photos, MP3 files]

Advantages

  • NoSQL databases can run across several servers, so scaling them is cheaper and easier in comparison to SQL DBs.
  • They are more fault tolerant as they don’t rely on a single server.
  • They are optimized for horizontal scaling, unlike relational databases which are optimized for vertical scaling.

Types of NoSQL databases

  • Key value stores — DynamoDB, Redis
  • Document stores — Stores information in a single BSON, JSON or SML file MongoDB, Couchbase
  • Column store [ Optimized for fast retrieval of columns of data ] Apache Cassandra, Scylla
  • Graph store [ Facilitates data visualization and graph analytics, optimized for graph data structures such as social networks] Neo4J, Datastax Enterprise

Mixing and matching databases

Sometimes, based on your use case, mixing two different databases yields better results in terms of performance. For example, Redis is often used in combination with other databases in most applications. Redis is chosen for cache and token storage for quick retrieval and database hit reduction. However, if you combine two databases that are equal in terms of resource use and data storage such as MongoDB and PostgreSQL, it will be totally a bad idea.

--

--

Anup Singh
Anup Singh

Written by Anup Singh

A highly enthusiastic computer engineer...

No responses yet