Databases
45 articles in this topic.
Metering, model routing and the regression suite that stops your agent rotting
Two questions decide whether an AI feature survives its first year: does each request make money, and will a prompt edit break something silently? An append-only credit ledger, two-tier routing, and a suite that asserts question-to-metric mappings are the answers.
Six ways Android will eat your background service, and what actually worked
A broadcast receiver is a lie, WAL journalling wedged openDatabase on OxygenOS, and one polite database close in a WorkManager teardown silently stopped the whole gateway. Six real failure modes from a production Android SMS gateway, and the fix for each.
What bench migrate actually does, and the rollback you'll wish you had
Every patch commits as it completes and records itself as applied. So a migration that fails halfway is not a failed migration, it is a half-finished one, and re-running will not undo it. Here is the recovery, with real commands.
Find the Query Killing Your ERPNext: A MariaDB Slow Query Log Playbook
Your ERP is slow and three queries are responsible. Configure the MariaDB slow query log properly, run pt-query-digest, and read the numbers that tell you whether it is an index problem or a hardware problem.
Indexes That Actually Work: A Field Guide to tabGL Entry and tabStock Ledger Entry
ERPNext ships mostly single-column indexes, which are the wrong shape for the reports killing your server. Real EXPLAIN output, the leftmost prefix rule, key_len maths, and the composite indexes that fix ERP reports.
Why we did not point an LLM at ERPNext: building a semantic layer for a business agent
Text-to-SQL against a real accounting schema produces confidently wrong numbers, because ERPNext stores revenue in the general ledger, stock valuation in the stock ledger, and gross margin nowhere at all. Here is the metric catalog and catalog-first hybrid engine we built instead.
bench backup Is Not a Backup Strategy: Binlogs and Point-in-Time Recovery for ERPNext
A nightly dump means losing a full day of invoices. Set up mariadb-backup plus binary logs, then walk a real recovery: finding the binlog position of a bad bulk cancel and replaying up to the second before it.
Your ERPNext Database Hit 40GB: What to Delete, Archive, and Partition
On most large ERPNext sites the real business data is under 20 percent of the total size. Measure the tables, gut the log bloat, chunk your deletes, understand the partitioning trap, and actually reclaim the disk.
HikariCP Connection Timeouts Are Not a Pool Size Problem
Connection is not available, request timed out after 30000ms almost never means the pool is too small. Here is how to find what is holding connections and fix it properly.
MySQL error 1213 deadlock found: retry it, you cannot prevent it
Error 1213 is InnoDB breaking a lock cycle on purpose, not a bug you can configure away. How to read the real deadlock, fix lock ordering, and retry the transaction correctly.
MySQL server has gone away: four unrelated causes, one message
Errors 2006 and 2013 are a shrug, not a diagnosis. Idle timeouts, packet size, read timeouts and a crashed server all produce them, and each needs a completely different fix.
MySQL 'Lock wait timeout exceeded': find the blocker, not a retry loop
Error 1205 names the wrong transaction. Here is how to find the one actually holding the lock, why the default rollback behaviour is dangerous, and the real fixes.
MySQL 'Got a packet bigger than max_allowed_packet bytes': Raising It Once Is Not Enough
You raised max_allowed_packet and the import still dies. There are six independent limits across a dump and restore, and mysqldump ignores the section you edited.
Postgres 'Could Not Resize Shared Memory Segment' Is Not Your Disk
No space left on device from Postgres in Docker means a 64MB /dev/shm, not a full volume. Here is the mechanism, the shm-size fix, and how to size it without inviting the OOM killer.
Postgres Won't Accept Writes: The Transaction ID Wraparound Runbook
Postgres refuses every write to avoid wraparound data loss. Why single-user mode is usually the wrong first move, what pins the freeze horizon, and the online fix.
FATAL: sorry, too many clients already - and why raising max_connections is wrong
Every Postgres connection is a separate OS process, so raising max_connections trades a clear error for an OOM. Here is the connection maths and the PgBouncer fix.
Postgres Reserved Connection Slots: Why 97 Counts as Full
Postgres subtracts superuser_reserved_connections from max_connections, so your app never had the number you configured. Here is the arithmetic and the fix that actually holds.
Prisma Connection Pool Timeouts in Production: What Actually Fixes Them
P2024 is a queueing symptom, not a pool-size problem. Why raising connection_limit turns a slow service into an outage, and what to do instead on serverless.
Slow SELECT * on InnoDB While Disk Read Speed Looks Low
A full table scan crawls at 8 MB/s on a disk that does hundreds. The answer is request size, not disk speed, and here is how to measure it in four steps.
Your Redis Cache Is Serving Yesterday's Data: Fixing Invalidation Properly
Stale cache incidents have no error message, only a DEL that returns 0. Here is why Redis invalidation breaks, the structural fix, and how to prove it worked.
Docker Compose Postgres connection refused: localhost is not your database
Inside a container, localhost means that container. Why your app cannot reach the Postgres service, the service-name fix, and the healthcheck that stops the race condition.
MySQL 'The table is full' (Error 1114): You Are Checking the Wrong Filesystem
ERROR 1114 names a table, but the table is rarely the problem. It is usually a full datadir, a full tmpdir, or a fixed-size InnoDB tablespace. Check storage first, in that order.
MySQL 'Waiting for table metadata lock': why 'online' ALTER TABLE still isn't free
An ALTER on a busy MySQL table hangs on 'Waiting for table metadata lock' and queues every query behind it. Here is what actually holds the lock, and why online DDL still stalls at cutover.
MySQL 'Illegal mix of collations' (Error 1267): The Fallout of a Half-Finished utf8mb4 Migration
MySQL error 1267 fires when a join compares columns with different collations, usually a half-done utf8mb4 migration. Unblock with COLLATE, then standardise the whole schema.
FATAL: role "postgres" does not exist in Docker: the POSTGRES_USER volume trap
The Postgres Docker image only reads POSTGRES_USER the first time it initializes an empty volume. Change it later and you get a role error that looks like a permissions bug but isn't.
Postgres Table Bloat: Why the Default Autovacuum Settings Are Too Passive
Postgres waits until 20% of a busy table is dead tuples before autovacuum fires, so bloat piles up silently. Here is how to tune it per table and confirm vacuum is keeping up.
The ORM N+1 Query Problem: Why It Ships to Production Undetected
A page that should issue 2 queries issues 201, and no tool catches it before production. Here is how N+1 hides, how to spot it, and the one-line fix per ORM.
Postgres PANIC 'No space left on device': do not delete pg_wal
A full disk PANICs Postgres into a crash loop, and deleting WAL files to free space turns it into a restore from backup. The safe recovery order, and the slot that caused it.
QueuePool Limit Reached Under FastAPI Load: pool_size Is Not the Fix
The SQLAlchemy QueuePool timeout under FastAPI load is about how long connections are held, not how many exist. Why raising pool_size fails, and the async session scoping that works.
Redis 'OOM command not allowed': Why Switching to LRU Can Cost You Data
The one-line fix for Redis OOM errors quietly deletes your data. Here is how to tell a safe cache instance from a durable one, and what to set for each.
'The Server Is Slow' With Zero Budget and No APM: A Command-Line Triage
No Datadog, no New Relic, no dashboards. Here is a free, repeatable command-line order to find why a production server is slow, using tools already on the box.
Frappe Custom Fields Hit MariaDB's 'max 64 keys allowed': Finding the Excess Indexes
A heavily customised Item or Customer DocType can silently pile up indexes until MariaDB refuses at 64. Here is how to list them, find the wasteful ones, and remove them safely.
MariaDB Won't Start After a Frappe Install: unknown variable 'innodb-file-format=barracuda'
The Frappe install docs still write innodb-file-format=barracuda into my.cnf, but MariaDB 10.3.1 removed that variable. Here is why mysqld refuses to start and the exact lines to delete.
MariaDB Not Configured for Barracuda: the Fix Depends on Your Version
Frappe's Barracuda error suggests a my.cnf block that crashes MariaDB 10.3+ because the variable was removed. Here is the version-correct config and how to recover.
MySQL 'Incorrect string value' on Emoji: Why utf8 Was Never Really UTF-8
MySQL's utf8 caps at three bytes and cannot store emoji, so four-byte characters throw Incorrect string value or truncate silently. Convert to utf8mb4 on every link.
How to See Progress of a Large MySQL Import (and Where pv Lies)
mysql < dump.sql gives no progress bar or ETA. Here is the pv workaround that shows live progress, plus why it hits 100% while the import keeps running.
pg_upgrade Fails on Extensions, Not Core: the Pre-Flight Check Teams Skip
pg_upgrade migrates Postgres core but not extensions, so PostGIS version gaps make the new cluster fail to start. Here is the inventory-and-match checklist to run first.
Idle in Transaction: The Postgres Sessions Quietly Bloating Your Database
A Postgres session sitting idle in transaction holds its snapshot and locks, blocks autovacuum, and grows table bloat for hours. Here is how to find them, kill them, and stop them coming back.
Reading Postgres EXPLAIN ANALYZE Correctly: the 'loops' Multiplier Everyone Misses
The 'actual time' on a plan node is per loop, not total. Miss the loops=N multiplier and you will underestimate a node's real cost by orders of magnitude and tune the wrong query.
Postgres timestamp vs timestamptz: the DST bug that only breaks twice a year
A plain timestamp column drops the time zone, so records shift by an hour at daylight saving changes and the bug hides for months. Here is the root cause, the fix, and a safe migration to timestamptz.
Postgres 'no pg_hba.conf entry for host': the scoped fix, not 0.0.0.0/0
The FATAL: no pg_hba.conf entry error has a two-minute fix that also opens your database to the whole internet. Here is the scoped rule to add instead.
MySQL Replication Lag: Why Seconds_Behind_Master Can Read Zero and Lie
Seconds_Behind_Source measures the relay log, not the primary, so it reads zero while your replica is minutes behind and NULL when it is broken. Here is how to see real lag.
The Postgres JSONB Anti-Pattern: When Flexible Schema Becomes No Schema
Burying queried fields in a JSONB column feels like skipping migrations until you cannot index or join them. Why the blob costs you, and the four-step migration out.
Access Denied for root@localhost After the MariaDB 10.4 Upgrade
MariaDB 10.4 authenticates root through the unix_socket plugin, so the password you have used for years now returns error 1698. What changed, how to get in, and the right fix.
Error 1055: MySQL 5.7 Rejected the GROUP BY Query That Worked for Years
ONLY_FULL_GROUP_BY is on by default in MySQL 5.7 and it broke half the reports in a legacy app. Why the old query was always wrong, and the four ways to fix it ranked by regret.