StackPractices

databases

Practical resources about databases for software engineers.

89 results

Storing, Querying, and Scaling Data

Databases are the persistence layer every application depends on. Choosing between relational and NoSQL, designing indexes, handling migrations, and optimizing slow queries are skills that directly impact user experience and infrastructure cost.

This section covers recipes for PostgreSQL and MySQL connections, MongoDB CRUD operations, Redis caching strategies, and schema design patterns. You will also find guides on ACID transactions, connection pooling, and full-text search implementation.

advanced

Design a DynamoDB Single-Table Schema for Serverless Apps

Design a DynamoDB single-table schema with composite keys, GSI patterns, and access patterns for...

advanced

Multi-Tenant Data Isolation Pattern

Isolate tenant data in shared infrastructure using row-level security, schema-per-tenant, or...

intermediate

Composite Entity Pattern

Map a coarse-grained entity to multiple database tables by composing dependent objects, so the...

intermediate

Data Mapper Pattern: Keep Domain Models DB-Free

Separate in-memory domain objects from the database by delegating persistence to a dedicated mapper...

intermediate

Database per Service Pattern

Give each microservice its own private database to ensure loose coupling, independent deployment,...

intermediate

Eager Loading Pattern: Fix the N+1 Problem

Load related data in a single query rather than multiple round-trips, preventing the N+1 problem...

advanced

Geode Pattern: Partition Data Across Independent Nodes

Partition data so each node owns a non-overlapping shard with its own storage. Horizontal scaling...

intermediate

Identity Map Pattern

Cache objects by primary key so each database row maps to a single in-memory instance per...

intermediate

Materialized View Pattern

Precompute and store expensive query results in a read-optimized cache to avoid repeated costly...

intermediate

Repository Pattern with TypeScript Generics

Implement a type-safe repository pattern in TypeScript that decouples data access logic from domain...

intermediate

Serverless DB Connection Pooling Pattern

Manage database connections across serverless invocations by using external connection poolers,...

advanced

Sharding Pattern

Split a large dataset into smaller partitions (shards) distributed across multiple servers to...

intermediate

Specification Pattern

Encapsulate business rules for selecting objects as reusable, composable predicate objects that can...

intermediate

Unit of Work Pattern

Track changes to in-memory objects during a business transaction and commit all updates atomically...

advanced

Data Migration Runbook Template with Rollback Steps

Use this data migration runbook template to plan safe migrations. Includes pre-migration checks,...

intermediate

Database Failover Runbook

A step-by-step runbook for executing database failover procedures safely with minimal downtime and...

intermediate

Database Query Tuning Checklist

A working checklist for tuning slow SQL queries: read the EXPLAIN plan, fix indexes, kill N+1...

intermediate

Database Schema Documentation Template

A template for documenting database schemas with entity relationships, field definitions, and...

advanced

Complete Guide to RAG in Production

Take RAG to production: chunking strategies, vector store selection, hybrid retrieval, reranking,...

intermediate

Data Lake vs Data Warehouse — Architecture Guide

How data lakes store raw data at scale: medallion zones, lakehouse tables, ETL vs ELT,...

No results found.