Database
An organized collection of structured data stored electronically and managed by software for efficient storage, retrieval, and manipulation.
Also known as: DB, Data Store, Data Repository
Category: Software Development
Tags: databases, software-development, data-storage, software-architecture
Explanation
A database is an organized collection of structured data, typically stored electronically in a computer system. Databases are managed by Database Management Systems (DBMS) that provide mechanisms for storing, retrieving, updating, and managing data. They are fundamental to virtually all modern applications, from simple mobile apps to complex enterprise systems.
**Types of Databases**:
**Relational Databases (RDBMS)** store data in tables with rows and columns, using SQL for queries. Tables can be linked through relationships using foreign keys. Popular examples include PostgreSQL, MySQL, SQLite, Microsoft SQL Server, and Oracle Database. These are ideal for structured data with clear relationships.
**NoSQL Databases** are non-relational databases designed for specific data models and flexible schemas:
- Document stores (MongoDB, CouchDB) store data as JSON-like documents
- Key-value stores (Redis, DynamoDB) use simple key-value pairs for extreme speed
- Wide-column stores (Cassandra, HBase) organize data in column families
- Graph databases (Neo4j, Amazon Neptune) model nodes and relationships
**NewSQL Databases** (CockroachDB, TiDB, Spanner) combine the relational model with NoSQL scalability.
**Specialized Databases** serve specific use cases: time-series databases (InfluxDB, TimescaleDB), search engines (Elasticsearch, Meilisearch), vector databases for AI/ML (Pinecone, Weaviate, pgvector), and embedded databases (SQLite, LevelDB).
**Key Database Concepts**:
**ACID Properties** guarantee reliable transaction processing:
- Atomicity: Transactions are all-or-nothing
- Consistency: Data remains valid after transactions
- Isolation: Concurrent transactions don't interfere
- Durability: Committed data persists
**Normalization** is the process of organizing data to reduce redundancy, progressing through normal forms (1NF, 2NF, 3NF) to eliminate repeating groups and dependencies.
**Indexing** uses data structures that speed up queries at the cost of storage and write performance. Common types include B-tree (default for most databases), hash indexes, GIN/GiST (for full-text search and JSON), and bitmap indexes.
**Choosing the right database** depends on your needs: PostgreSQL for general-purpose web apps, SQLite for simple local storage, Redis for caching, MongoDB for document flexibility, Neo4j for graph relationships, and TimescaleDB or InfluxDB for time-series data.
Related Concepts
← Back to all concepts