Database
Organised collection of data that can be stored and queried electronically. Relational databases use tables; NoSQL uses flexible models.
Databases are the memory of every application. Customer data, orders, sensor readings or chat history – everything is stored, organised and queried in databases. Choosing the right database is one of the most important architecture decisions and affects performance, scalability and cost for the life of the application.
What is Database?
A database is an organised system for storing, managing and querying data electronically. A DBMS (Database Management System) is the software that runs database operations. Relational databases (RDBMS) like PostgreSQL, MySQL and SQL Server store data in tables with rows and columns linked by relationships (foreign keys). SQL is the standard query language. NoSQL databases like MongoDB (document), Redis (key-value), Cassandra (wide-column) and Neo4j (graph) use flexible models for specific use cases. NewSQL (e.g. CockroachDB) combines SQL with horizontal scaling.
How does Database work?
A relational database stores data in normalised tables (e.g. customers, orders, products) linked by foreign keys. SQL (SELECT, INSERT, UPDATE, DELETE) reads and changes data. Transactions (ACID) ensure consistency. Indexes speed up queries. ORMs (Prisma, TypeORM, SQLAlchemy) abstract SQL in code. Replication distributes data across servers for resilience and read performance.
Practical Examples
PostgreSQL for SaaS: Multi-tenant with row-level security, JSON for flexible structures and full-text search.
MongoDB for content: Flexible documents for different content types (articles, videos, podcasts) without a fixed schema.
Redis for caching: Cache for frequently read data (sessions, API responses) – response time from milliseconds to microseconds.
Neo4j for recommendations: Graph database for relationships between users, products and purchases – basis for recommendation engines.
Typical Use Cases
Web apps: PostgreSQL or MySQL for users, content and business data
E-commerce: Catalogue, orders, customers and inventory
Analytics: Data warehouses (BigQuery, Redshift) for BI and reporting
Real-time: Redis and MongoDB for chat, scores and IoT data
Search: Elasticsearch or Meilisearch for full-text and faceted search
Advantages and Disadvantages
Advantages
- Integrity: ACID in relational DBs keeps data consistent
- SQL: Universal query language with decades of use
- Scaling: Replication, sharding and managed services enable horizontal scale
- Flexibility: NoSQL fits varied structures and access patterns
- Managed: Cloud (AWS RDS, Supabase, PlanetScale) handles operations and backup
Disadvantages
- Schema: Relational DBs need migrations when structure changes
- Scaling limits: Vertical scaling hits hardware limits; horizontal is complex
- ORM overhead: Abstractions can lead to inefficient queries (e.g. N+1)
- Operations: Self-hosted DBs need backup, monitoring, updates and tuning
Frequently Asked Questions about Database
PostgreSQL or MySQL?
When SQL and when NoSQL?
What does a database cost?
Related Terms
Want to use Database in your project?
We are happy to advise you on Database and find the optimal solution for your requirements. Benefit from our experience across over 200 projects.