Database
How a database works inside an application
In any non-trivial application, the database is the layer that holds state once a request ends. The application code never touches raw storage directly: it talks to a database management system (DBMS) such as PostgreSQL, MySQL, MariaDB, SQL Server, MongoDB or Redis, which handles persistence, indexing and concurrent access.
The database typically sits behind the application server and is reached through a connection, a query language and a data access layer (an ORM like Eloquent, Hibernate or Prisma, or raw queries). Its core responsibilities are:
- Persistence — data survives restarts, deployments and crashes.
- Integrity — constraints, types and relationships prevent invalid data from being stored.
- Concurrency — multiple users can read and write at the same time without corrupting state, usually through transactions and locking.
- Querying — data is retrieved by criteria rather than read sequentially, often accelerated by indexes.
- Security — access control, authentication and isolation from the public network.
For most business software (CRM, ERP, internal platforms), the database is the single source of truth. Its schema design directly shapes performance, maintainability and the cost of future changes.
Relational vs NoSQL: choosing the right model
The main architectural decision is between a relational database (SQL) and a NoSQL database. Relational systems store data in tables with fixed columns and enforce relationships and a schema; NoSQL covers several models (document, key-value, wide-column, graph) that trade strict structure for flexibility or horizontal scale.
| Criterion | Relational (SQL) | NoSQL |
|---|---|---|
| Data model | Tables, rows, columns with relationships | Documents, key-value pairs, graphs or wide columns |
| Schema | Fixed, defined upfront, enforced | Flexible or schema-less |
| Query language | SQL (standardised) | Varies by engine and model |
| Transactions | Strong ACID guarantees | Often eventual consistency; ACID varies |
| Scaling | Primarily vertical; horizontal is harder | Designed for horizontal scaling |
| Typical examples | PostgreSQL, MySQL, MariaDB, SQL Server | MongoDB, Redis, Cassandra, Neo4j |
| Best fit | Structured data, complex relations, reporting | High volume, variable structure, caching, real-time |
For most B2B business applications with well-defined entities, invoicing rules and reporting needs, a relational database remains the default: ACID transactions and referential integrity protect business-critical data. NoSQL is chosen for specific workloads — caching, event streams, document storage, or massive horizontal scale. Many production systems combine both (polyglot persistence).
Questions fréquentes
Building a custom software project? We design bespoke software aligned with your roadmap.
See our custom software expertiseDéfinitions liées