Skip to content
Kumar Chandrachooda
Series

The Database Is the Message Bus

In reading order.

  • 18 parts
  • ≈ 105 min total
  • 18 published
Part 1 03 May 2025 8 min read

The Database Is the Message Bus

Five executables, zero queues - how an attendance platform coordinated a web app, three Azure Functions and a console job through one SQL database, and what that choice bought and cost. Part 1 of the series.

Part 2 08 May 2025 5 min read

Syncing the Org Chart at Midnight

A daily Azure Function mirrors the HR system's employee master into the attendance database - a field-by-field upsert, a clever delegation rule, a vestigial handshake, and the parse calls that can kill the whole run.

Part 3 12 May 2025 5 min read

A Watermark Made of Your Own Success Log

The leave sync resumes from wherever its own job log last said Success - one table serving as log, watermark and metrics store at once, with recursive pagination on top and an envelope check in exactly the wrong place.

Part 4 16 May 2025 5 min read

When a Cancelled Leave Rewrites Last Month

Leave records arrive late, change and get cancelled - so the sync reaches back into already-approved attendance rows and re-derives them, carefully stepping around human decisions and allowance money.

Part 5 21 May 2025 5 min read

Guessing Your Shift with Manhattan Distance

Badge gates record when you arrived, not which shift you worked - so the platform infers it, scoring every candidate shift by L1 distance in time-of-day space and letting the smallest number win.

Part 6 25 May 2025 6 min read

Gap-Filling Two Years of Attendance

The shift calculator writes one report row per employee per day since 2019, inventing blank rows for days nobody badged - a dense date spine built from sentinel values, at the price of one database round-trip per row.

Part 7 30 May 2025 5 min read

ModifiedBy Is a State Machine

Four magic strings in an audit column decide which rows the batch jobs may overwrite and which belong to humans - provenance, workflow state and inter-job protocol smuggled into a field meant for names.

Part 8 03 Jun 2025 6 min read

A Work Queue in a Table Named Tolerance

When one job needs another to redo work, it leaves a row - an action enum, a rewind date and a Done flag standing in for a message broker, plus the delete-and-replay proc that makes reruns possible.

Part 9 07 Jun 2025 6 min read

The Error Logger That Cannot Log

A 22-character job name, a 20-character column, and an error handler that has thrown on every attempt since the day it shipped - plus the four parallel logging systems that still could not catch it.

Part 10 12 Jun 2025 6 min read

Nagging by Timer — the Ten-Hour Swipe-Out Email

Every five minutes a function hunts for people still virtually swiped in past ten hours and emails them - magic node numbers, an at-most-once flag with a gap in it, and a local config file pointing straight at production.

Part 11 16 Jun 2025 6 min read

An Attendance System Plays Timezone Roulette

UTC timers, IST badge gates, DateTime.Now in one executable and UtcNow in the next, columns that record neither - how a system whose entire product is timestamps got away with never deciding what time it is.

Part 12 21 Jun 2025 5 min read

Two Dynamic-SQL Procs — One Injectable, One Correct

The same database solves the same sortable-paging problem twice - once by concatenating user input straight into EXEC, once with a CASE whitelist, QUOTENAME and sp_executesql. A side-by-side of the wrong and right answer.

Part 13 25 Jun 2025 6 min read

Fourteen Foreign Keys and an Index Named Placeholder

Thirty-eight tables, fourteen foreign keys, none on the tables that need them - plus a shipped SSMS template index, auto-tuning suggestions accepted blind, three-state booleans and a demo mode that mutates production master data.

Part 14 30 Jun 2025 6 min read

Org Charts in T-SQL, Three Ways

One hierarchy, three implementations - a recursive CTE, a view that calls a scalar function on every row, and a whole family of tree procs - plus a relationship flag that is a decimal number pretending to be binary.

Part 15 04 Jul 2025 5 min read

The Payroll Month Starts on the Sixteenth

The business month runs the 16th to the 15th, so a year-overview proc carries twelve correlated subqueries, five-day-capped weeks, time averaged through float casts and contractor filters that drift by a digit between copies.

Part 16 08 Jul 2025 7 min read

One Metric, Three Answers

The same dashboard KPI is computed by three different formulas across role-variant procedures, rendered on a gauge with a sibling metric quietly deleted - and the fact table beneath it is an accidental Kimball star nobody designed.

Part 17 13 Jul 2025 6 min read

CI Theatre and a NuGet Feed Made of Folders

Four pipelines run dotnet test against projects with no tests and pass every time, the shared model ships as committed .nupkg files in a folder, one executable has no pipeline at all, and a DLL with no source hides an algorithm pasted inline elsewhere.

Part 18 17 Jul 2025 7 min read

Five Executables, One Database — the Reckoning

The honest ledger for the whole estate - what coordinating through tables actually cost, what genuinely earned its keep, and what I would reach for now instead of using the database as a message bus.