Database
An organized store of persistent data managed so software can create, retrieve, update, protect, and recover information.
Download Markdown (.md)Soroush’s Product Wiki · https://wiki.soroush.uk/topic/database/
01What it means
A database is an organized collection of data managed by a database system. The system provides mechanisms to store, query, update, constrain, secure, and recover data. Databases use different models—including relational, document, key-value, graph, and wide-column—whose structures and guarantees suit different access patterns.[1][2]
- Data model
- Structure and relationships
- Queries + updates
- Language, API, or driver
- Constraints
- Correctness and identities
- Indexes
- Measured access paths
- Concurrency + durability
- Coordination and persistence guarantees
- Operations
- Security, backup, recovery, capacity, migration
Relational, document, key-value, graph, and wide-column models suit different relationships, access patterns, and guarantees.
02Why it matters
Product accounts, orders, content, permissions, and operational records must survive individual processes and remain usable as the product changes. Database choices influence correctness, latency, scalability, analytics, privacy, recovery, and the cost of future changes.
03When to use it
Use a database when structured or semi-structured product state must persist, be queried, shared, or recovered reliably. A file, object store, cache, search engine, or event log may be better for a narrower workload, and many systems combine specialized stores deliberately.
04How it works
- Model the data, relationships, access patterns, retention needs, and correctness requirements.
- Choose a database model and system whose guarantees and operational characteristics fit those needs.
- Define structures, constraints, indexes, identities, and access controls.
- Applications issue reads and writes through a query language, API, or driver.
- The database coordinates storage, concurrency, durability, and retrieval according to its guarantees.
- Operate backups, recovery tests, monitoring, capacity planning, migrations, and lifecycle policies.
05A practical example
A marketplace stores customers, listings, orders, and payment references in a database. Constraints prevent orders without valid customers, transactions preserve multi-step updates, indexes support common lookups, and tested backups protect against operator or infrastructure failure.
06Where it breaks
A database cannot correct a poor domain model, ambiguous ownership, unsafe access, or missing retention policy. Every system trades among consistency, availability, latency, query flexibility, cost, and operational complexity, and persistence does not replace tested backups.
Common mistakes
- Choosing a database from popularity before defining access patterns and correctness needs.
- Treating the database as an integration interface shared freely by unrelated services.
- Assuming replication is a backup or that backups work without restoration tests.
- Keeping data indefinitely without privacy, retention, deletion, and archival decisions.
07Sources
- Architectural FundamentalsPostgreSQL Global Development Group · Official technical documentationArchitectural Fundamentals
- Databases and CollectionsMongoDB · Official technical documentationDatabases and Collections