CREATE TABLE IF NOT EXISTS samples (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  node TEXT NOT NULL,
  ts TEXT NOT NULL,
  http_latency_ms REAL NOT NULL,
  tcp_rtt_ms REAL NOT NULL,
  dns_resolve_ms REAL NOT NULL,
  tls_handshake_ms REAL NOT NULL,
  throughput_kbps INTEGER NOT NULL DEFAULT 0
);

CREATE INDEX IF NOT EXISTS idx_samples_node_ts ON samples (node, ts DESC);
