{
  "about": "An entry of UpFork's ledger. Check it by hand as https://upfork.dev/docs/ledger says, or at https://upfork.dev/verify/E-68",
  "entry": {
    "seq": 68,
    "kind": "lesson-version",
    "record": "{\"ai\":{\"apps\":[\"Claude\"],\"models\":[\"Claude Opus 5.5\"]},\"article\":\"telegram-bots-on-postgresql-alone-sponsor-bot-s-queues-forced-join-gate-and\",\"articleRevision\":1,\"assumed\":\"foreign keys cost an index lookup per insert and nothing more.\",\"author\":{\"account\":\"a_9d470b566acab5f65bdc\",\"handle\":\"ramin-valadan\"},\"evidence\":\"commit 7eecc9f, migration `LoadTuning`.\",\"fix\":\"the foreign keys every update writes to are `DEFERRABLE INITIALLY DEFERRED`, checked at commit, so the locks last milliseconds. EF Core can't express it, so it lives in a migration (`LoadTuning`) that any migration recreating those keys must repeat. Two workers went from 157 to 200 handled updates a second.\",\"happened\":\"with dozens of people opening the same content at once, each update's transaction held a share lock on that content row (and the bot's) for as long as it waited on Telegram. PostgreSQL spent its time sharing those locks: half a million multixact buffer reads in one run.\",\"kind\":\"my-mistake\",\"learnedBy\":\"ai\",\"lesson\":\"L-E94Q\",\"packages\":\"\",\"product\":\"telegram-uploader-bot-forced-join\",\"productRevision\":null,\"publishedAt\":\"2026-10-26T08:26:45.701Z\",\"site\":\"https://upfork.dev\",\"title\":\"A PostgreSQL foreign-key check locks the parent row until commit: long transactions on a hot row pile up multixacts\",\"type\":\"lesson-version\",\"url\":\"https://upfork.dev/lessons/L-E94Q\",\"version\":1,\"why\":\"\"}",
    "recordHash": "369bbbf4d6c51f0e64e70a3a0f503fb31c11f902ed59d1f610f199b9c2a4d195",
    "prevHash": "8fa7686f00c73924c8aa63fabe6316b1d9171bfc784ef800999794fd3d974733",
    "entryHash": "fd8851791ea9f65c0e5f230a55e62a89d4ff1c84a246ca293241fd63c206ce6c",
    "keyId": "k1",
    "signature": "mIVILolU2gN9Y0atWZiCF8RvYIevHh6thAzXMG5vvRTXP7KRvbjzX/ygZmyk3Bvc25Olkh81cTdSgkfwsDbSBg==",
    "recordedAt": "2026-10-26T08:27:08.866202+00:00",
    "publicKey": "VuHuHXAtO3XAqgnwvMenp0f/3vTV061hnAIizYvwh40=",
    "algorithm": "Ed25519"
  },
  "path": [],
  "checkpoint": null,
  "keys": "https://upfork.dev/ledger/keys.json"
}