Database SQL vs NoSQL
Introduce
Sometime we stand in front of decision, whether to use SQL or NoSQL Database. Here it is, shortly explicitly shown the difference between them and when it may be better to chose which.
SQL vs NoSQL
SQL | NoSQL |
---|---|
When you access pattern* is not defined. | When you access pattern* is defined. |
When you want to perform flexible/ relational queries. | When your data model fits (for example for friends domain, graphs seems natural choice). |
When you want to enforce field constraints. | When your data model may quite often change. |
When you want to use well documented access language (SQL). | When you need high performance and low latency. |
How to Pick - Example Scenarios
- Small project + Low Scale + Unkown Access Patterns = SQL
- Large project + High Scale + Relational Queries = SQL with read replicas
- Medium/Large project + High Scale + High Performance = NoSQL
So we may say that NoSQL fits better for larger projects and SQL are better for smaller ones, but it’s general assumption and it of course depends :)
Access patterns matrix
It will help yo define how the users and the system access the data to satisfy business needs, and which database you should use.
Field | NoSQL |
---|---|
Access pattern | Provide a name for the access pattern. |
Description | Provide a more detailed description of the access pattern. |
Priority | Define a priority for the access pattern (high/medium/low). This defines the most relevant access patterns for the application. |
Read or write | Is it a read access or write access pattern? |
Type | Does the pattern access a single item, multiple items, or all items? |
Filter | Does the access pattern require any filter? |
Sort | Does the result require any sorting? |
Comments