Every ClickHouse® DBA has lived this

The FINAL headache

ReplacingMergeTree removes duplicates only when background merges get to them. Until then, every query that forgets FINAL can count the same row twice.

1
Business analyst
The numbers in this table are wrong — some records are duplicated!
order_idstatus
1042pending
1042shipped
1043paid
2
DBA
You should use the FINAL modifier.
SELECT … FROM orders FINAL
3
Business analyst
No other database makes me do that. What a hassle.

…and every dashboard, BI tool and ad-hoc query has to remember it too.

4
DBA
…
The pain behind the joke
  • Forget FINAL once and a report silently double-counts.
  • FINAL deduplicates at query time, adding latency and memory pressure.
  • Forcing merges with OPTIMIZE … FINAL rewrites data and is no fix for live tables.
With UpsertCH

UpsertMergeTree skips superseded rows on ordinary reads. Analysts write the same SELECT they would anywhere else and get one current row per key.

SELECT … FROM orders -- 1042 · shipped
Built on ClickHouse® v26.10 · Native C++ storage engines

The real-time state & analytics engine for autonomous AI agents.

Skip the PostgreSQL-to-ClickHouse CDC pipeline. UpsertMergeTree returns the latest row for each key without FINAL, and MemCache keeps hot state in RAM — in one ClickHouse®-compatible server, soon as a turnkey AWS Marketplace AMI.

Build 26.10.1.1 Linux amd64 AWS Marketplace coming soon
CREATE TABLE agent_session_state
(
    tenant_id   UInt64,
    trace_id    UInt64,
    version     UInt64,
    status      String,
    tokens_used UInt32
)
ENGINE = UpsertMergeTree(version)
PARTITION BY tenant_id
ORDER BY (tenant_id, trace_id)
UNIQUE KEY (tenant_id, trace_id);

INSERT INTO agent_session_state VALUES (1, 42, 1, 'RUNNING', 120);
INSERT INTO agent_session_state VALUES (1, 42, 2, 'COMPLETED', 480);

-- Latest row per key, no FINAL keyword
SELECT status, tokens_used FROM agent_session_state
WHERE tenant_id = 1 AND trace_id = 42;
-- 'COMPLETED', 480
Syntax as documented for build 26.10.1.1 · see SQL docs
Two native engines

Mutable state and OLAP
in one process.

Agents overwrite the same keys all day — session status, balances, positions, prices. UpsertCH stores those writes where they can be read back as current state and aggregated with ClickHouse® SQL, without a second database.

Disk-backed · versioned

UpsertMergeTree

Latest-row storage with a UNIQUE KEY and a version column. Ordinary SELECT queries skip superseded rows within each partition, so reads see the winning row without FINAL or waiting for background merges.

  • Keep every version of a logical key in the same partition
  • Standard ClickHouse® SQL for filters, joins and aggregates
RAM-resident · keyed

MemCache

A bounded latest-state cache with composite KEYS, declared lookup INDEX clauses and version-based replacement. Disk persistence is on by default; persist_mode='none' makes it memory-only.

  • Exact key and indexed lookups for hot state
  • Survives graceful restarts when persistence is enabled
ConcernReplacingMergeTree + FINALUpsertCH
Reading the latest stateSELECT … FINAL merges at query timePlain SELECT sees winning rows
Hot point lookupsSparse index reads whole granulesMemCache key lookups from RAM
System footprintRedis/Postgres + Kafka/CDC + ClickHouse®One server process
Architecture

Retire the CDC trap.

Fewer moving parts between an agent's write and the dashboard that reads it.

Legacy stack

The CDC trap

  1. PostgreSQL / RedisMutable application state
  2. Debezium / KafkaChange data capture pipeline
  3. ClickHouse® ReplacingMergeTreeDuplicates until background merges finish
  4. SELECT … FINALQuery-time deduplication: higher latency and memory pressure
UpsertCH

Single-binary simplicity

  1. AI agents / high-throughput streamsInsert new versions as state changes
  2. Native protocol (TCP 9000) or HTTP (8123)Standard ClickHouse® clients and drivers
  3. UpsertMergeTree + MemCacheVersioned latest-row storage and RAM cache
  4. Current-state reads + OLAPPlain SELECT, no FINAL, same SQL engine
Validation & benchmarks

What is tested today.

We publish what each build has actually passed. Performance benchmarks will be published with reproducible scripts alongside the AWS Marketplace AMI.

Native tests 7 / 7

Stateless engine tests passed on the release binary — 0 failures, 0 skips.

Packages 3 .deb

Clean Ubuntu install, start and graceful restart checks, with SHA-256 verified binaries.

Persistence Restart

MemCache winners verified to persist across an actual server restart.

Cloud EC2

Installed and smoke-tested on Amazon EC2 with Ubuntu 26.04 LTS, including a booted AMI.

Known limits. Cold primary-index I/O and unfiltered UpsertMergeTree LIMIT queries can still be slow. Deduplication is partition-local. SQL BACKUP/RESTORE and CHECK TABLE are not supported for UpsertMergeTree yet. Large-scale performance figures are not yet certified.
Use cases

Built for state that
never stops changing.

01 · AI agents

Agent observability & memory checkpoints

Track step state (pending → running → completed), aggregate token usage for billing, and store MCP server state next to the trace history you analyze.

02 · Trading

Algorithmic trading & risk engines

Keep the latest quote and position per symbol current, compute drawdown from the same tables, and backtest over historical ticks in one engine.

03 · Gaming

High-frequency interactive economies

Maintain wallet balances and turnover, deduplicate replayed stream messages by key and version, and tag suspicious activity as it happens.

04 · Commerce

Dynamic pricing & ad-tech bidding

Converge out-of-order webhooks and crawler updates by version so pricing and bidding agents always read the newest state.

Compliance & security

An AMI designed for
your own AWS account.

The AWS Marketplace image is in development. These are its design requirements; the listing will document each one when it goes live.

Data sovereignty

Runs in your VPC

Instances run in your AWS account. Your data stays on your EBS volumes; nothing is sent to us.

Storage

Separate OS and data volumes

The OS lives on the root volume and data on a dedicated GP3 volume at /data/clickhouse, so upgrading means launching a new AMI and re-attaching the data volume.

Credentials

No baked-in secrets

No SSH keys, shell history or default passwords in the image. The initial database password is generated at first boot from the EC2 instance ID.

Instance identity

IMDSv2

Instance metadata is accessed with IMDSv2 session tokens, including first-boot setup and licensing checks.

Patching

Security updates, pinned engine

Ubuntu LTS with security-only unattended upgrades, while the engine packages are held so OS updates never replace them.

Hardware

Modern x86 instances

Requires x86-64-v3 with PCLMUL — for example r6i, r7i, m7i, c6i or t3. Graviton/ARM is not supported yet.

Pricing

Simple, metered through AWS.

Planned AWS Marketplace pricing. The software fee is billed hourly on your AWS invoice, on top of standard EC2 infrastructure charges.

Developer / Sandbox

$0 / hr software fee

7-day free trial on AWS Marketplace. EC2 infrastructure costs apply.

  • Up to 4 vCPUs (c6i.xlarge / r6i.xlarge)
  • Both engines included
  • Documentation and community support

Enterprise annual

Custom

Annual contracts through AWS Marketplace Private Offers.

  • About 20% below hourly pricing
  • Multi-node licensing
  • Dedicated engineering support
The AWS Marketplace listing is not live yet. Final prices are the ones shown on the listing. Subscriptions, cancellations and refunds are handled through AWS Marketplace — see Support & refund policy.