{
  "slug": "turnstile-stream",
  "term": "Turnstile stream",
  "aliases": [
    "Turnstile model",
    "Strict turnstile model",
    "General turnstile model"
  ],
  "definition": "A turnstile stream updates a frequency vector with positive or negative increments, allowing earlier contributions to be reduced or reversed.",
  "note": "Strict turnstile requires every underlying frequency to stay nonnegative throughout the stream; general turnstile allows negative balances. Insertion-only streams are the special case with no negative increments. These conditions concern the true vector, not merely nonnegative sketch buckets. [synopses]\n\nOrdinary additive Count-Min with its minimum estimator supports valid deletions under nonnegative true frequencies. A negative balance can invalidate its one-sided bound. The original paper also gives a median estimator for the general case, so signed updates are not exclusive to CountSketch. [cm]\n\nA negative increment is an arithmetic operation, not evidence of a legitimate deletion. In the constructed histories x at time 0 then y at 10, and y at 0 then x at 10, the final vectors agree. Expiring time 0 leaves different keys. A timestamp-free summary cannot identify that expired contribution. [example]",
  "related": [
    "count-sketch",
    "count-min-sketch"
  ],
  "citations": [
    {
      "id": "synopses",
      "title": "Cormode, Garofalakis, Haas and Jermaine. Synopses for Massive Data. Author manuscript, sections 5.2 and 5.3.2.",
      "url": "https://www.cs.ox.ac.uk/people/graham.cormode/pubs/papers/FnT.pdf",
      "accessed": "2026-11-20"
    },
    {
      "id": "cm",
      "title": "Cormode and Muthukrishnan. The Count-Min Sketch and its Applications. Author preprint, 16 December 2003, sections 2-4.1.",
      "url": "https://www.cs.ox.ac.uk/people/graham.cormode/pubs/papers/cm-full.pdf",
      "accessed": "2026-11-20"
    },
    {
      "id": "example",
      "title": "Hesela. Exact signed-frequency and expiration examples, with executable tests. Constructed finite maps, not random-hash validation.",
      "url": "https://hesela.dev/research/countsketch/model.test.mjs",
      "accessed": "2026-11-20"
    }
  ],
  "provenance": [
    "Frequency means the accumulated per-key weight, which can be a signed balance in the general model; it is not necessarily a nonnegative event count. [synopses]",
    "The exact expiration example is an information-loss construction, not a claim about a named windowing implementation. [example]"
  ],
  "status": "research",
  "advantages": [],
  "limitations": [],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-11-20"
}
