Skip to content
Module 8 · Lesson 17 of 25

ClickHouse for delivery analytics

Part of KumoMTA: High-Volume Sending Engine, in the Logging, Hooks & ClickHouse module.

Author

ClickHouse turns billions of log rows into sub-second analytics. KumoMTA documents the schema upstream, and most ESPs run with it from day one.

Sample table:

CREATE TABLE kumomta_events (
  ts DateTime,
  type LowCardinality(String),
  tenant LowCardinality(String),
  campaign LowCardinality(String),
  domain LowCardinality(String),
  egress_source LowCardinality(String),
  response_code UInt16,
  enhanced_code LowCardinality(String),
  bounce_category LowCardinality(String),
  recipient String,
  message_id String
) ENGINE = MergeTree
ORDER BY (ts, tenant, domain);

Bread-and-butter queries:

-- Delivery rate per destination, last hour
SELECT domain,
       countIf(type='Delivered') / countIf(type IN ('Delivered','Bounced')) AS delivery_rate
FROM kumomta_events
WHERE ts > now() - INTERVAL 1 HOUR
GROUP BY domain ORDER BY delivery_rate DESC;

-- Top bounce categories per tenant
SELECT tenant, bounce_category, count() AS n
FROM kumomta_events WHERE type='Bounced' AND ts > today()
GROUP BY tenant, bounce_category ORDER BY n DESC LIMIT 50;

This is where deliverability stops being guesswork. You can answer "is our Yahoo delivery degrading?" in seconds.

Sign in to keep track of what you have read.

Pulse · email sending

Sending infrastructure that is yours alone.

Every domain gets its own MX host, IP, DKIM selector and certificate. Take it managed, and we run it for you, or buy a licence and run it on your own servers.

# on a fresh Ubuntu server
$ cd pulse && sudo ./install.sh
→ docker compose up · kumomta · stalwart · caddy
→ dashboard ready on https://pulse.yourdomain.com
$

Also from us:Beat: monitoring that tells you the fixConsulting: $65/hr, no retainer