Blogs · Data · Database

Database Intro

A compact introduction to databases, covering relational systems, NoSQL systems, transactions, schemas, indexes, and when each storage pattern fits.

2020.07.01 · 2 min read · by Zhenlin Wang

Introduction

A database stores data so applications can read, write, update, query, and protect it reliably. The right database depends on the shape of the data and the workload.

The most important question is not “SQL or NoSQL?” It is:

What access patterns must this system support?

Relational Databases

Relational databases store data in tables with rows and columns. They are a strong default when data has clear structure and relationships.

Examples:

Use relational databases when:

NoSQL Databases

NoSQL systems relax some relational assumptions to support different access patterns.

Common types:

NoSQL is not automatically more scalable. It is better when its data model matches the problem.

Transactions

A transaction groups operations so they succeed or fail together.

The classic ACID properties are:

Financial systems, order systems, and inventory systems usually need strong transaction guarantees.

Schema

A schema defines the structure of data.

Strong schemas help:

Flexible schemas help when data changes often, but they move more validation responsibility into application code.

Indexes

Indexes speed up reads by storing searchable structures for selected columns or fields.

They are not free:

Index the queries that matter, not every column.

Choosing a Database

Ask:

Start with the simplest database that satisfies the system requirements. Complexity is easy to add and hard to remove.