Skip to content
StackPractices

Tag: database

Browse 38 practical software engineering resources tagged with "database". Discover code recipes, design patterns, documentation templates, and in-depth guides to help you build, deploy, and maintain production-ready solutions involving database.

Pagination

How to implement cursor-based and offset-based pagination in APIs and databases across Python, JavaScript, and SQL.

Implement the Cache-Aside Pattern with Redis

Use the cache-aside pattern to read and write data through Redis, handling cache misses, stale reads, and write-through invalidation

UUID Generation

How to generate universally unique identifiers (UUIDs) for database keys, session tokens, and resource naming across Python, JavaScript, and Java.

Implement ACID Transactions in PostgreSQL

How to use PostgreSQL transactions to ensure Atomicity, Consistency, Isolation, and Durability for reliable multi-step database operations

Caching with Redis

How to implement application caching using Redis for performance and scalability.

Handle Database Deadlocks and Retries

Detect, prevent, and recover from database deadlocks with automatic retry logic, isolation levels, and query ordering strategies.

Manage Database Migrations Safely

How to version, apply, and rollback database schema changes using migration tools like Flyway, Alembic, and Liquibase in production environments.

Database Migrations Safely

How to run database schema migrations without downtime or data loss.

Set Up Database Read Replicas for Scaling

Scale read-heavy workloads with database read replicas, replication lag monitoring, and read/write splitting across primary and replica instances.

Database Transactions

How to use ACID transactions to ensure data integrity across Python, JavaScript, and Java with SQL examples.

Create and Use Database Views and Materialized Views

How to create and use database views and materialized views to simplify queries and improve read performance

Elasticsearch Aggregations for Analytics and Search

How to use Elasticsearch aggregations to build faceted search, analytics dashboards, and real-time metrics from indexed data

Implement Event Sourcing in a Relational Database

Build event sourcing systems using relational databases with event stores, projections, and snapshotting for audit and temporal querying.

Full-Text Search

How to implement full-text search with Elasticsearch, Meilisearch, and PostgreSQL.

CRUD Operations with MongoDB and Mongoose

How to perform Create, Read, Update, and Delete operations in MongoDB using Mongoose ODM with Node.js and Express

Implement Optimistic Locking with Versioning

How to implement optimistic locking with versioning to prevent lost updates in concurrent database access

Redis Cache Patterns for High-Performance Applications

How to implement cache-aside, write-through, and write-behind patterns with Redis to reduce database load and improve response times

Soft Deletes

How to implement soft deletes to preserve data while hiding records from normal queries.

SQL Joins

Practical examples of INNER, LEFT, RIGHT, and FULL OUTER JOINs with real-world query patterns.

Set Up Connection Pooling for Databases and HTTP Clients

How to set up connection pooling for databases and HTTP clients to improve performance and reliability

Optimize Queries with Database Indexing

How to create, analyze, and maintain indexes to speed up database queries and avoid common indexing mistakes.

Optimize Slow Database Queries

How to identify, analyze, and fix slow SQL queries using EXPLAIN, query refactoring, and database-specific optimization techniques.

Prevent SQL Injection with SQLAlchemy Parameterized Queries

Protect Python applications from SQL injection using SQLAlchemy parameterized queries, ORM models, input validation, and query inspection to ensure safe database access

Prevent SQL Injection Attacks

How to write parameterized queries and use ORMs to eliminate SQL injection vulnerabilities across Python, JavaScript, and Java.

Live Database Credentials with HashiCorp Vault

How to use HashiCorp Vault to generate short-lived database credentials, eliminating hardcoded passwords and reducing secret sprawl

Active Record Pattern

Wrap a database table or view in a class where an instance is tied to a single row, and the class provides methods for CRUD operations directly on the object.

Data Access Object (DAO) Pattern

Abstract and encapsulate all access to a data source by exposing a clean interface while hiding persistence details from business logic.

Backup & Restore Verification Template

A template for documenting database and file backup verification procedures.

Data Migration Runbook Template

A runbook template for safely migrating data between systems including pre-migration checks, rollback procedures, and post-migration validation.

Database Failover Runbook

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

Database Migration Runbook Template

A database migration runbook template for executing schema changes safely with rollback procedures, verification steps, and communication plans.

Database Schema Documentation Template

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

Data Migration: Zero-Downtime Strategies That Work

A practical guide to data migration: planning, dual-write patterns, backfill strategies, schema evolution, validation, and rollback procedures for moving data without service interruption.

CAP Theorem and Database Trade-offs

A practical guide to the CAP theorem: consistency, availability, and partition tolerance. Learn how to choose the right trade-offs for your application.

Database Design Guide

A practical guide to designing relational databases with normalization, indexing, and relationship modeling.

Database Sharding and Partitioning Strategies

A practical guide to horizontal partitioning (sharding), vertical partitioning, and range vs hash strategies. Scale databases without downtime.

NoSQL Database Selection — MongoDB, DynamoDB, Cassandra

A practical guide to choosing the right NoSQL database. Compare document, key-value, wide-column, and graph stores with selection criteria and migration tips.

SQL Performance Tuning — Indexes, Queries, and Explain Plans

A practical guide to optimizing SQL queries: indexing strategies, query rewriting, EXPLAIN plan analysis, and common anti-patterns to avoid.