{
  "advantages": [
    {
      "text": "Makes extra secondary indexes cheap to maintain, because each index update becomes a buffered insert rather than a query.",
      "citationIds": [
        "primer"
      ]
    }
  ],
  "limitations": [
    {
      "text": "The 2015 prototype's per-block deletion cost is version-specific, not an inherent requirement of every buffered index.",
      "citationIds": [
        "betrfs"
      ]
    },
    {
      "text": "The caller must be able to proceed without the computed result to retain the benefit of a blind update; returning the old value requires obtaining it.",
      "citationIds": [
        "betrfs-faq"
      ]
    }
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-12-01",
  "slug": "buffered-upsert",
  "term": "Buffered upsert",
  "aliases": [
    "Upsert message"
  ],
  "status": "research",
  "definition": "A buffered upsert encodes a deferred transformation of a key's value without first fetching that value.",
  "note": "In B-epsilon trees, pending transformations must be applied in insertion order when the key is queried or the messages reach its leaf. This is not simply SQL insert-or-update syntax, and it does not by itself specify transaction isolation or durable acknowledgement. [primer]\n\nAn upsert message carries the key, a callback function and auxiliary data. When it is flushed to the leaf, the stored value is replaced by the callback result and the message is discarded. A query that arrives first applies the pending messages found on the root-to-leaf path. Tombstones are a special case, and counters or access times are other examples. [primer]\n\nThe primer reports nodes of about 4 MB, branching factors from 4 to 16 and batches of at least 256 KB in its implementations. Its query argument concerns I/O along the existing search path: pending callbacks do not require an extra node path. This is not a guarantee of unchanged elapsed latency; callback CPU work, message count and contention still matter. [primer]\n\nA write-optimized research file system from 2015 turns most metadata changes and partial block writes into upserts, avoiding a read-modify-write for each small write. [betrfs]",
  "related": [
    "b-epsilon-tree",
    "lsm-tree",
    "lsm-tombstone",
    "range-rename",
    "late-binding-journal",
    "betrfs",
    "write-optimized-dictionary",
    "tokufs"
  ],
  "citations": [
    {
      "id": "primer",
      "title": "Bender, Farach-Colton, Jannen, Johnson, Kuszmaul, Porter, Yuan and Zhan. An Introduction to B-epsilon-trees and Write-Optimization. ;login: 40(5), 2015.",
      "url": "https://www.usenix.org/system/files/login/articles/login_oct15_05_bender.pdf",
      "accessed": "2026-10-23"
    },
    {
      "id": "hesela-buffered",
      "title": "Hesela. B-epsilon trees: visible updates, deferred work",
      "url": "https://hesela.com/analyses/b-epsilon-trees-buffered-updates/",
      "accessed": "2026-10-16"
    },
    {
      "id": "betrfs",
      "title": "Jannen et al. BetrFS: A Right-Optimized Write-Optimized File System. FAST 2015, pp. 301-315, sections 2-4.",
      "url": "https://files.usenix.org/s3fs-public/cdn/fast15-paper-jannen_william.pdf",
      "accessed": "2026-10-22"
    },
    {
      "id": "betrfs-faq",
      "title": "BetrFS authors. Frequently Asked Questions, upserts and blind writes; historical prototype guidance, not a current-release specification.",
      "url": "https://www.betrfs.org/faq.html",
      "accessed": "2026-10-23"
    }
  ],
  "provenance": [
    "primer is Bender et al., ;login: October 2015. Basic operations and upserts, pp. 22-26, rechecked on 2026-10-23.",
    "betrfs is Jannen et al., FAST 2015, read in sections 2 to 4.",
    "The node and batch figures are historical implementation descriptions in primer. Its query-performance argument concerns I/O; no new elapsed-time benchmark or speedup estimate is supplied."
  ]
}
