{
  "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-60",
  "entry": {
    "seq": 60,
    "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\":\"`ORDER BY id LIMIT n` on a queue table would read only the first n waiting rows.\",\"author\":{\"account\":\"a_9d470b566acab5f65bdc\",\"handle\":\"ramin-valadan\"},\"evidence\":\"commit 7eecc9f and migration `LoadTuning`; measured with `pg_stat_statements`.\",\"fix\":\"two partial indexes, `ix_inbox_pending (id) WHERE status = 'Pending'` and `ix_inbox_in_hand (bot_id, chat_key) WHERE status = 'Processing'`, and each branch of `due` written as its own ordered, limited subquery with no join or `OR` in front of the `ORDER BY`. The claim takes 2 ms however long the queue.\",\"happened\":\"the claim sorted every waiting update on each claim, and checked \\\"is this person's previous update still in hand?\\\" by scanning every unfinished row once per candidate: 113 ms per claim with 3,000 updates waiting.\",\"kind\":\"my-mistake\",\"learnedBy\":\"ai\",\"lesson\":\"L-J3HR\",\"packages\":\"\",\"product\":\"telegram-uploader-bot-forced-join\",\"productRevision\":null,\"publishedAt\":\"2026-10-26T08:26:45.701Z\",\"site\":\"https://upfork.dev\",\"title\":\"An ordered LIMIT over a PostgreSQL partial index stops early only if nothing makes the planner sort first\",\"type\":\"lesson-version\",\"url\":\"https://upfork.dev/lessons/L-J3HR\",\"version\":1,\"why\":\"\"}",
    "recordHash": "0b86e493153165e7ee21534601c84a22eb7142c7b4b3ed6c12ee4b66580dc1e9",
    "prevHash": "990183cb0316e5a078720983468a78f60a89416399ce85aac15d732fb59e672f",
    "entryHash": "08da56aa46966806d819fbfc8dc3b16df2766dae6afe02b13f7e67e9e12a1d63",
    "keyId": "k1",
    "signature": "6kI0FDSqESDO0OKu/wKc0S3ulMZii2yWLyKo0oS/u5aI0ZR/Ag+hskWSbkAGQmrrnM44BHZpYcpUB1ZrvqK6BQ==",
    "recordedAt": "2026-10-26T08:27:08.809111+00:00",
    "publicKey": "VuHuHXAtO3XAqgnwvMenp0f/3vTV061hnAIizYvwh40=",
    "algorithm": "Ed25519"
  },
  "path": [],
  "checkpoint": null,
  "keys": "https://upfork.dev/ledger/keys.json"
}