%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#2C3E50', 'primaryTextColor': '#fff', 'primaryBorderColor': '#16A085', 'lineColor': '#16A085', 'secondaryColor': '#E67E22', 'tertiaryColor': '#ecf0f1'}}}%%
flowchart LR
IoT[IoT Data] --> Choice{What Type<br/>of Data?}
Choice -->|Fixed Schema<br/>Relationships| Relational[(Relational DB<br/>PostgreSQL, MySQL)]
Choice -->|Flexible Schema<br/>JSON Documents| NoSQL[(NoSQL DB<br/>MongoDB, Redis)]
Choice -->|Time-Stamped<br/>Sensor Readings| TimeSeries[(Time-Series DB<br/>InfluxDB, TimescaleDB)]
Relational --> R1[Device Metadata<br/>User Accounts]
NoSQL --> N1[Event Logs<br/>Configuration Data]
TimeSeries --> T1[Sensor Readings<br/>Metrics Over Time]
style IoT fill:#E67E22,stroke:#2C3E50,color:#fff
style Choice fill:#7F8C8D,stroke:#2C3E50,color:#fff
style Relational fill:#2C3E50,stroke:#16A085,color:#fff
style NoSQL fill:#16A085,stroke:#2C3E50,color:#fff
style TimeSeries fill:#2C3E50,stroke:#16A085,color:#fff
1275 Data Storage Overview
Learning Objectives
After completing this chapter series, you will be able to:
- Select appropriate database types for different IoT use cases
- Understand the CAP theorem and its implications for IoT systems
- Implement relational, NoSQL, and time-series databases for IoT data
- Design data partitioning and sharding strategies
- Implement data quality monitoring and retention policies
- Optimize storage costs through tiered architectures
Core concept: Database selection depends on your data shape (relational vs. document vs. time-series) and the CAP theorem trade-offs between consistency, availability, and partition tolerance. Why it matters: The wrong database choice leads to 10x higher costs, query timeouts, and scaling nightmares; the right choice enables real-time analytics at IoT scale. Key takeaway: Use relational databases for transactional data with relationships, time-series databases for sensor readings, and document stores for flexible device metadata–then implement multi-tier retention (hot/warm/cold) to control storage costs.
1275.1 Introduction
IoT systems generate diverse data types requiring different storage strategies. Sensor readings demand time-series optimization, device metadata needs relational structure, and multimedia content requires object storage. Choosing the right database technology is crucial for performance, scalability, and cost-effectiveness.
This chapter series covers all aspects of IoT data storage:
1275.1.1 Chapter Guide
| Chapter | Focus | Best For |
|---|---|---|
| Database Selection Framework | Choosing the right database type | Starting a new IoT project |
| CAP Theorem and Database Categories | Distributed systems trade-offs | Designing for scale and reliability |
| Time-Series Databases | TimescaleDB, InfluxDB optimization | Sensor data storage |
| Data Quality Monitoring | Quality metrics and validation | Production systems |
| Sharding Strategies | Horizontal scaling patterns | Large-scale deployments |
| Worked Examples | Fleet management, data lake design | Learning by example |
1275.1.2 IoT Storage Challenges
IoT systems face unique storage challenges:
- Scale: Billions of devices, petabytes of data
- Velocity: High-frequency writes (1000s/second per device)
- Variety: Structured, semi-structured, unstructured data
- Retention: Long-term storage (years) vs short-term (hours)
- Cost: Storage costs can exceed compute costs
- Access patterns: Write-heavy, time-range queries
1275.1.3 The Three Main Database Types for IoT
| Type | Analogy | Best For | Examples |
|---|---|---|---|
| Relational | Spreadsheet with strict columns | Device metadata, user accounts | PostgreSQL, MySQL |
| NoSQL | Flexible JSON file | Event logs, config data | MongoDB, Redis |
| Time-Series | Optimized data log | Sensor readings, metrics | InfluxDB, TimescaleDB |
1275.1.4 Quick Reference: Database Comparison
| Database Type | Best For | Scalability | Query Complexity | Write Speed |
|---|---|---|---|---|
| Relational (SQL) | Structured data, ACID | Vertical | High (SQL) | Medium |
| Document (NoSQL) | Semi-structured | Horizontal | Medium | High |
| Key-Value | Simple lookups | Horizontal | Low | Very High |
| Time-Series | Time-stamped data | Horizontal | Medium | Very High |
| Graph | Relationships | Horizontal | High (traversals) | Medium |
1275.2 Where to Start
New to databases? Start with Database Selection Framework to understand how to choose the right database for your IoT use case.
Building for scale? Read CAP Theorem and Database Categories to understand distributed systems trade-offs.
Working with sensor data? Jump to Time-Series Databases for optimization techniques.
Learning by example? Check Worked Examples for fleet management and smart city data lake designs.
1275.3 What’s Next
Continue with Database Selection Framework to learn how to choose the right database technology for your IoT application.