Jump to content

User:EEvans (WMF)/Notes/KrvDataModels

From Wikitech
-- XXX: Indexing?  How do we know which `p`s contain a `k`?
CREATE TABLE cold (
  p int,    -- Date-based partitioning value
  k text,
  r int,
  t timeuuid,
  v blob,
  PRIMARY KEY((p, k), r, t)
);

-- Used by VE; All values written to w/ TTL
CREATE TABLE warm (
  k text,
  r int,
  t timeuuid,
  v blob,
  PRIMARY KEY(k, r, t)
);

-- Used by VE; Always the latest value
CREATE TABLE hot (
  k text PRIMARY KEY,
  r int,
  t timeuuid,
  v blob
);
CREATE TABLE cold (
  k text,
  r int,
  t timeuuid,
  v blob,
  PRIMARY KEY(k, r, t)
)
CREATE TABLE day (
  k text,
  r int,
  b int,    -- Time bucket
  v blob,
  PRIMARY KEY(k, r, b)
)
-- Partition stores the most current value for every revision.
CREATE TABLE latest (
  k text,
  r int,
  v blob,
  PRIMARY KEY(k,r)
)

-- Alternate; Partition stores the value for the most current revision (which
-- is also stored so that we know which revision that is).
CREATE TABLE latest (
  k text PRIMARY KEY,
  r int,
  v blob
)