3.1.3.1. Database Types and Use Cases
3.1.3.1. Database Types and Use Cases
💡 First Principle: Diverse database types offer specialized storage and retrieval, optimized for unique data models and access patterns, ensuring efficient, scalable data management for varied application needs.
AWS provides a highly diversified portfolio of managed database services, each optimized for specific workloads and data models. Choosing the right database is fundamental for performance, scalability, and cost.
Key AWS Database Services and their Use Cases:
- Relational ("Amazon RDS", "Amazon Aurora"): Structured data, fixed schema, strong ACID compliance. Ideal for OLTP (Online Transaction Processing) workloads like ERP, CRM, e-commerce, and transactional applications requiring complex joins and strong consistency.
- Aurora vs. standard RDS: Aurora (MySQL/PostgreSQL-compatible) separates compute from a distributed storage volume that keeps six copies of data across three AZs and grows automatically as data is added. AWS cites up to 5x the throughput of standard MySQL and 3x of PostgreSQL, and Aurora supports up to 15 low-lag Aurora Replicas. Choose it over RDS for MySQL/PostgreSQL when you need higher performance and availability without managing storage capacity.
- Engine extensions: Relational engines can add specialised capabilities. For example, the PostGIS extension on RDS/Aurora PostgreSQL adds geospatial types and distance/radius queries ("everything within 5 miles of this point").
- "NoSQL (Amazon DynamoDB", "Amazon DocumentDB")": Flexible schema, non-relational, high scalability, low latency.
- "DynamoDB": Key-value and document. Ideal for web, mobile, gaming, IoT, and microservices needing flexible schema with high throughput at any scale.
- Querying DynamoDB efficiently: Fast
Queryoperations work only on the table's keys, and aScanreads the whole table. To query on another attribute (e.g., look users up by email), add a Global Secondary Index (GSI) with that attribute as its partition key; GSIs can be added at any time. A Local Secondary Index (LSI) keeps the table's partition key and only supplies an alternative sort key, and it must be defined when the table is created. - "DocumentDB": MongoDB-compatible document database.
- In-memory ("Amazon ElastiCache"): Very low latency, high throughput. Primarily for caching, session management, and real-time analytics.
- Data Warehouse ("Amazon Redshift"): A fast, fully managed, petabyte-scale columnar data warehouse. Optimized for complex analytical queries (OLAP) over large datasets. Ideal for business intelligence and reporting.
- Graph ("Amazon Neptune"): A fully managed graph database service. For highly connected datasets (social networks, recommendation engines, fraud detection).
- Time Series ("Amazon Timestream for InfluxDB"): A managed time-series database running the open-source InfluxDB engine, with single-digit-millisecond query responses for real-time analytics. For IoT and operational applications that need to store and analyze time-series data. (The original serverless engine, Timestream for LiveAnalytics, has been closed to new customers since June 20, 2025.)
Scenario: For a high-traffic e-commerce product catalog requiring flexible schema and low-latency performance at scale, choosing Amazon DynamoDB (NoSQL) is ideal.
Visual: AWS Database Types and Use Cases
⚠️ Common Pitfall: Forcing a relational database (e.g., RDS) to handle a workload that is clearly better suited for a NoSQL database (e.g., unstructured data with extreme read/write scale), leading to performance issues or excessive costs.
Key Trade-Offs:
- Data Model Rigidity (Relational) vs. Flexibility (NoSQL): Relational databases enforce strict schemas but provide strong consistency and joins. NoSQL databases offer flexible schemas and high scalability but might sacrifice some relational features.
Reflection Question: How does selecting the right database type (e.g., relational, NoSQL, in-memory, data warehouse) fundamentally impact an application's scalability, performance, and cost-efficiency by matching its unique data model and access patterns?