Based on Kevin Chen (PhoenixAI)'s session at NextQuery 2026, Real-time Customer-Facing Analytics for Apps and Agents. Watch the session.
Customer-facing analytics has a stricter standard than internal reporting. The people reading the numbers are your customers, inside your product, and they judge you on every page load. They expect the latest data and a fast page while the data underneath keeps changing, and you have to deliver both to your largest and smallest customers at once.
To make this concrete, imagine a finance SaaS platform where about 200 businesses run their books. An accountant at one of them, call it Northwind, is closing out March. She notices that invoice 1042 went in as $500 when it should have been $800. She corrects it, hits save, and the page reloads her receivables and the March P&L, which are sums over every invoice and payment Northwind has ever recorded.
If the page still shows $500, she assumes the save failed. She enters the correction again and now the invoice is counted twice, or she opens a support ticket about a number that was already right. Say your platform promises that a change shows up within 2 seconds, and the reload has to be fast while accountants at the other 199 businesses do the same thing.
In this post, we look at the two problems behind that page: keeping numbers fresh and fast on data that keeps changing, and serving tenants of very different sizes on one system. For each, we show how PhoenixAI handles it and what our benchmarks measured.
Finance Data Is Not Append-Only
Invoices get corrected, payments get reversed, and a mistyped amount gets fixed seconds later. Most engines give you two ways to handle that kind of update, and each one costs you something. ClickHouse's ReplacingMergeTree engine shows both trade-offs.
- Query the raw table, and pay on every read. An update is written as a new version of the row, and background merges remove old versions later, on the engine's schedule. Until then, any query that needs the right answer has to add
FINAL, which reads every part, merges rows by theORDER BYkey and keeps the highest version, then does it all again on the next reload. With no writes running, we measured the same 57 million rows at 336 ms withoutFINALand 674 ms with it. ClickHouse's documentation notes thatFINALneeds extra compute and memory and disables parallel replicas. - Precompute the report in a materialized view, and get the wrong answer. ClickHouse incremental MVs fire on each inserted block. When the $800 arrives as a new row version, the MV adds it but has no way to take the old $500 back out, so the Northwind accountant's P&L shows $1,300. The alternative is to rebuild the MV on a schedule, and then it shows $500 until the next rebuild.
You end up with fresh but slow, or fast but wrong. For an accountant, $1,300 is not an approximation.
Resolve the Update Once, When It Is Written
In PhoenixAI, we handle the update in two places. The table has to absorb updates without leaving old versions for every query to sort out, and the report on top of it has to pick up each update without recomputing everything.
The first piece is the primary key table. It keeps an index from each key to the location of its current row. When the $800 comes in, PhoenixAI looks up invoice 1042 in that index, flags the old $500 row in a small delete vector next to its data file, and writes the new row.
When the Northwind accountant's page reads the table, the scan skips flagged rows. There is no merge, no FINAL, and nothing waiting on a background job before the answer is correct. Instead of paying for the update on every read, you pay for it once, at write time. This design is where the 3–6x raw-table advantage over ClickHouse in our benchmark comes from.
An MV That Retracts the Old Value
The Northwind accountant's P&L is still a sum over many rows, and a page that reloads all day should not re-add them each time. The second piece is an incremental materialized view in PhoenixAI. It keeps the aggregated result, such as totals by tenant, account and month, and applies only what changed on each refresh.
A refresh runs in four steps:
- Read the changes. Change data capture is turned on for the base table, so the MV reads every change since its last refresh. An update carries both the old value and the new value.
- Compute the delta. For a
SUMor aCOUNT, the refresh retracts the old value and adds the new one, which gives the change for each affected group. - Find the group. The deltas are joined to the MV on the group key to fetch each group's current total. A group that is not in the MV yet starts from zero.
- Write it back. The MV is itself a primary key table, so writing a group's new total replaces its old row. Only the groups that changed are touched.
Each refresh reads only the changes and rewrites only the groups they affect, so the MV stays cheap to keep current. Her page reads a few precomputed totals instead of every invoice line. On the same cluster with the same writes running, the single-table query in our benchmark drops from 275 ms on the raw table to 60 ms on the MV.
The $500 to $800 Correction, Step by Step
Here is the Northwind accountant's correction run through a PhoenixAI incremental MV end to end. The invoice line she fixed books office supplies for Northwind in March, so the MV's next refresh reads two entries from the change feed: the old $500 line going out and the new $800 line coming in.

Source: PhoenixAI, NextQuery 2026
The MV keeps one row per tenant, account and month, with two totals: the net amount and the number of lines. For the row Northwind · Office Supplies · March, −500 plus +800 is +300, so the net amount moves from $12,400 to $12,700, and the line count stays at 37 because one line went out and one came in. No other group is touched and nothing is recomputed from scratch. It is the same bookkeeping the accountant does for a living.
What We Benchmarked
We turned this finance example into a benchmark and ran it on PhoenixAI and on ClickHouse. The workload is modeled on one of our fintech SaaS customers. We can't share their data, so we generated a dataset with the same shape.
- Data: about 110 million transaction lines covering 24 months, across 200 tenants of very different sizes.
- Writes: about 10,000 rows per second into both systems during every query, with 80% of them overwriting an existing key.
- Hardware: 24 vCPU on each side. PhoenixAI ran on 3 nodes of 8 vCPU; ClickHouse ran as one 24 vCPU replica on ClickHouse Cloud, so it never paid for cross-node traffic.
- Queries: a single-table P&L query and a two-way join, covering 64 to 128 tenants, returning the same rows on both systems.
- Measurement: server-side P95, best of three rounds, both systems running at once.
- Limits: the data is synthetic, and we did not test ClickHouse lightweight updates.
PhoenixAI vs ClickHouse With Updates Running

Source: PhoenixAI, NextQuery 2026
With about 10,000 rows per second of writes running, these are the P95 results from our benchmark:
- Single-table query: ClickHouse 887 ms, PhoenixAI on the raw table 275 ms (3.2x faster), PhoenixAI with the incremental MV 60 ms (14.8x faster).
- Join query: ClickHouse 1,622 ms, PhoenixAI on the raw table 287 ms (5.7x faster), PhoenixAI with the incremental MV 53 ms (30.6x faster).
P50 and P99 latency pointed the same way. In the same runs, we also ran a freshness probe that wrote one row per second and polled every 100 ms. A correction like the Northwind accountant's showed up in the MV within 1.6 to 1.8 seconds (P95 over six runs), inside the 2-second target, and the page reloaded in 53 to 60 ms while the benchmark kept writing about 10,000 rows per second.
Why One Large Tenant Slows Down Everyone Else
The second problem shows up once a multi-tenant SaaS platform signs its biggest customers. In our benchmark dataset, the largest tenant holds about 15% of all rows, the top 10 hold about a third, and the smallest 100, half of all tenants, hold less than a quarter combined. That is good for the business, but it changes what the database has to do.
Almost every query in a product like this filters to one tenant. So the question for the database is where each tenant's rows physically live, and how many machines can work on them at once. When one tenant is much larger than the rest, the answer decides whether that tenant's queries slow down everyone else. It looks like a fairness problem, but it is a scaling problem.
Why Hash Distribution Breaks Down With Skewed Tenants
In PhoenixAI, a table is divided into partitions, for example one per month. Each partition is divided into tablets, the unit of storage, and each tablet is served by one node. So the tablets that hold a tenant's rows decide which nodes do the work, and the question that matters is which tablet a row goes to.
Hash distribution answers it by hashing the tenant ID into one of N buckets, where you set N at CREATE TABLE. That works well when tenants are about the same size. With skewed tenants, it breaks down in three ways:
- One tenant, one node: every row of your largest tenant lands in the same bucket, so one tablet on one node does all of its work while the other nodes wait.
- More buckets, more overhead: adding buckets or key columns spreads the load but produces thousands of small tablets. In one of our engineering tests, a hash table had 2,020 tablets of about 30 MB each, and under continuous writes the compaction and publish work for all of them left little CPU for queries.
- Fixed at creation: you chose the bucket count when you created the table, possibly years ago when tenants were similar in size. When the tenant mix changes, the fix is to rebuild the table.
Range Distribution Splits the Big Tenant Online
Range distribution, available in PhoenixAI today, takes the other approach. You don't choose a bucket count. You declare a sort key, for example the tenant ID followed by a date, and each tablet holds a continuous stretch of that key. Each partition starts as a single tablet. When a tablet grows past its size threshold, it splits, and the split point comes from the actual distribution of keys in your data rather than from a hash.
In practice, a small tenant stays together in one tablet, which keeps its data local and cheap to scan. A large tenant is cut into several ranges placed on different nodes, so its queries can use the whole cluster. The split is a metadata change rather than a rewrite of the data, and it happens online: in one of our tests, a 1.5 GB tablet split into three in under a second, with no change to the schema or the SQL. If your tenant mix shifts later, the table keeps splitting along the new distribution, and you don't have to rebuild it.
Range vs Hash at 41% Skew
To test range distribution in PhoenixAI, we let the biggest tenant grow to 41% of all rows. We ran it on the same cluster as the first benchmark (3 compute nodes, 24 vCPU) with 600 million rows, and both tables had 9 tablets. Because the data is smaller than a production table, we lowered the split target from 10 GB to 2 GB so that range distribution would split the way it would in production. With hash distribution, the largest tenant sat in a single 7 GB tablet on one node; with range distribution, it was spread over 4 tablets across all 3 nodes.
- Bulk load: 464 s with hash, 240 s with range.
- One aggregate query on the largest tenant: 3.0 s with hash, 1.3 s with range.
- Queries on small tenants: under 30 ms with either layout, so small tenants paid nothing for the change.
- 8 concurrent users for a little over two minutes, each picking tenants in proportion to their size: throughput went from 0.81 to 1.9 queries per second (2.3x), and P95 latency dropped from 34 s to about 18 s.
The Gain Grows With Skew
Our engineering team then repeated the hash-versus-range comparison in PhoenixAI and changed only one variable: the largest tenant's share of the data.

Source: PhoenixAI, NextQuery 2026
- 14% share: hash 78 QPS, range 80 QPS, effectively even.
- 43% share: hash 27 QPS, range 48 QPS, 1.8x.
- 67% share: hash 26 QPS, range 54 QPS, 2.1x.
Our 41% test, at 2.3x, sits on the same curve: the bigger your largest customers get, the more range distribution pays off. The pattern held on other workload shapes. On a 1,000-tenant HR SaaS workload, range distribution delivered 1.6x the throughput and cut P99 latency from 67 s to 29 s, with small tenants unchanged. In an ad analytics workload measured while data was loading, hash distribution pinned one node's CPU at 96% while range distribution spread the load evenly.
If your tenants are all about the same size, the layout matters much less. In a test with uniform keys, range distribution delivered 1.2x the throughput with the same tail latency, so there is little to gain but nothing to lose. The gains are clear when a few tenants are much larger than the rest, many users query at once, and writes never stop, which describes most multi-tenant products. For multi-tenant tables, we recommend range distribution.
Agents Make Both Problems Harder
So far the Northwind accountant has been clicking through a page that someone designed in advance. Now picture her asking an agent, "Which vendors can we pay today?" To answer, the agent checks available cash, pulls open payables, looks at what is due this week, and schedules the payments. That is several queries for one question, with filters nobody built a dashboard for, and the answer is about to move real money.
Both problems get harder:
- Fresh and fast: agents ask ad hoc questions on data that just changed, and you can't precompute everything an agent might ask. The raw table has to be fast on its own, and the MVs you do keep have to stay current.
- Big and small tenants: one question becomes several queries, from every tenant at the same time. With more queries in flight, a large tenant concentrated on one node hurts more, so data layout matters more.
No one wants an agent paying vendors from last night's balance. In PhoenixAI, primary key tables and incremental MVs keep the numbers current, and range distribution keeps the largest tenant from setting the pace for everyone else.
You Should Not Have to Pick
Customer-facing analytics usually forces you to choose between fresh numbers, fast pages and fair treatment of small tenants. In our benchmark, PhoenixAI primary key tables and incremental MVs that retract old values made a correction like the Northwind accountant's visible in 1.6 to 1.8 seconds and served the page in 53 to 60 ms, 15–30x faster than ClickHouse, while about 10,000 rows per second kept arriving. Range distribution served 2.3x the queries at 41% skew with small tenants unchanged, and it is what we recommend for multi-tenant tables.
Agents raise the bar again: they ask ad hoc questions on data that just changed, so the raw table has to be fast on its own and the MVs you keep have to stay current.