The callback that quietly doubled our database
A Rails after_save callback silently duplicated database rows: how the symptom appeared, why the obvious suspect was innocent, and the real root cause.
A Rails after_save callback silently duplicated database rows: how the symptom appeared, why the obvious suspect was innocent, and the real root cause.
PostgreSQL replicas on Kubernetes can get stuck in a WAL segment removed loop that passes liveness checks, and three fixes stop it for good.
Running pg_dump on a PostgreSQL replica can fail with conflict with recovery errors because the backup is a long read transaction colliding with WAL replay.
A PostgreSQL replica cancels long queries with conflict with recovery errors during VACUUM replication, and hot_standby_feedback fixes it without downtime.
How to split Redis into isolated session, cache, and Sidekiq instances so a cache blip never logs users out or stops background jobs.
A practical comparison of [type, id] versus [id, type] composite index order for polymorphic associations in Rails and MySQL, and how to choose.
Blue/green node pools plus a Kubegres replica promotion let you upgrade a GKE cluster, PostgreSQL included, without a maintenance window.
Keeping counters and summaries accurate in Rails without slowing down writes means separating core data in a transaction from derived data updated after commit.
Install PostgreSQL from the PGDG repo on Ubuntu, set up a matching development role, and debug the password authentication failures Rails hits most.
Rails 8's load_async runs association queries concurrently instead of one after another, and getting it right means sizing your connection pool correctly.
PostgreSQL 18 deprecates MD5 authentication, and migrating to SCRAM-SHA-256 in mixed mode lets you switch pg_hba.conf without downtime or forced app changes.
PostgreSQL 18 adds better query parallelism, parallel logical replication apply, and more flexible partitioning, plus the pg_upgrade and dump/restore paths to get there.
A one-line feature request, recording why a student failed a course, walks through three schema options: a nullable column, a normalized table, and jsonb.
Multi-step Rails forms need somewhere to hold data between steps, and this compares session storage, direct Redis caching, and temporary DB rows for that job.
Comparing PostgreSQL jsonb columns against a traditional linking table for modeling course prerequisites, and where a hybrid of both makes more sense.
How foreign key checks cause deadlock contention in MySQL InnoDB versus PostgreSQL, and why PostgreSQL's FOR KEY SHARE lock reduces the risk considerably.
How to stop duplicate Rails requests from creating the same record twice, using a Redis-backed semaphore lock instead of chasing a race condition.
How Redis Sentinel split-brain happens during Kubernetes node maintenance, and the sentinel tuning, anti-affinity, and PDB changes that stopped it.
Two concurrent requests can both pass an exists? check and race to insert the same row; here is why, and how to write idempotent Rails controllers.
When async updates to the same record can finish in any order, the oldest write can silently overwrite the newest one; here is how to stop that.
How deadlocks form in MySQL and PostgreSQL under concurrent updates, and the trade-off between foreign key integrity and write throughput.
Two services sharing a database can pass every test and still fail in production if their DB configuration silently drifts apart.
How to design a booking API that replaces regular time slots with alternatives, using server-side merging, cache versioning, and idempotency keys.
A cordon-drain-upgrade runbook for Kubernetes nodes, plus the PodDisruptionBudgets, priority classes, and lifecycle hooks that prevent outages.
Why ordering ActiveRecord results by an associated table's column breaks with includes, and how references, Arel, and left_joins fix it for good.
How ActiveRecord's includes prevents N+1 queries in Rails, and the common mistakes with order, filtering, and pluck that silently break it.
When Laravel's save() silently returns false versus when saveOrFail() throws, and how to pair both with validation and database transactions.
A quick-reference list of MySQL and MariaDB commands for databases, tables, users, and grants, kept for copy-pasting from the shell.
Materialized views cache expensive PostgreSQL queries as physical tables, trading storage and refresh cost for fast reads, plus how pgpool fits in.
Upgrading PostgreSQL can leave sequences out of sync with table max values, causing duplicate-key errors and blocked sign-ins, fixed here with SQL and bash.
Caching, the Oj gem, eager loading, background jobs, and load_async each cut serialization time for deeply nested Rails associations like classrooms and scores.
delete_all skips callbacks and dependent associations while destroy_all runs them, and picking the wrong one silently breaks counter caches and cascades.
A bash script that sets up PostgreSQL logical replication, publications, and subscriptions to perform a major-version upgrade without downtime.
How Redis Sentinel provides high availability: quorum-based monitoring, master election, automatic failover, and what your client applications must do to follow along.
What joins, preload, eager_load, and includes actually do in ActiveRecord, shown with real SQL logs, plus the chained calls that quietly bring the N+1 back.
How splitting static and dynamic fields, granular fragment caching, and incremental loading keep a large, frequently updated list fast without stale data.
How Kubegres brings primary/standby failover, automatic backups, and PITR to a self-hosted PostgreSQL cluster on Kubernetes without a managed database bill.
When two services share one database, a schema change in either one can silently break the other, and here is how to split ownership with APIs or events.
A comparison of Discard and ActsAsParanoid, the two common Rails soft-delete gems, and the query and unscope pitfalls each one introduces.
How ActiveRecord's unscope method selectively removes where and order conditions from default scopes, with examples and alternatives like merge and unscoped.
A comparison of database auditing options, pg_audit, audited, paper_trail, Hibernate Envers, and SQL Server temporal tables, and when each one fits.