Backend Database: SQL vs NoSQL? - pinocchio61/Architecture GitHub Wiki

Title: Backend Database - SQL vs NoSQL?

Context

To support functionalities that do not need the decentralized database(blockchain), we will introduce a self-hosted database into our backend. This database would store data entities, such as organizers' info, events info, and etc. Those data is not as critical as those stored on the blockchain, so they are stored off-chain.

Investigation of different choices

SQL vs NoSQL

Choices SQL NoSQL
Pros ACID Support (eg. Financial systems) Flexibility in data schema design
SQL is mature and efficient Can scale easily
Cons Bad for unstable data structures To support ACID is hard
Horizontal scale is hard Query is not very efficient
On-premise MySQL MongoDB
Cloud AWS RDS AWS DynamoDB

Decision

We will adopt the NoSQL solution because:

  1. In the prototype stage, NoSQL could accommodate changes in a more efficient way; NoSQL can support the experimentations in a more flexible way;
  2. Considering supporting the US, scalability might be a potential concern;
  3. The data we plan to host is not so critical as financial transaction data. We host the critical data on the blockchain platform. Therefore, NoSQL is more suitable in our scenario.

To be specific, we will choose Amazon DynamoDB as our implementation along with our EC2 instances. In these days, SQL and NoSQL converge with each other. For example, DynamoDB also supports transactions, which was a SQL feature.

Status

accepted

Consequences

The team need to integrate the database provider both in development, test, and production environments. For development, it is recommended we use a docker image to keep all the envs consistent.

References

  1. sql vs nosql
  2. Amazon DynamoDB Transactions