Category
Databases
Every guide on Databases from Code With Karani - 45 field-tested articles on Databases for developers and teams.
45 articles
July 2026
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.
6 min read
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.
16 min read
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.
8 min read
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.
6 min read
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.
7 min read
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.
8 min read
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.
9 min read
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.
7 min read
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.
8 min read
June 2026
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.
8 min read
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.
8 min read
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.
10 min read
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.
8 min read
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.
9 min read
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.
9 min read
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.
7 min read
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.
10 min read
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.
8 min read
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.
8 min read
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.
9 min read
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.
9 min read
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.
10 min read
May 2026
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.
9 min read
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.
7 min read