Quick revision
The short answer
I would not let product features query the analytics warehouse directly. Warehouses are built for throughput on large scans, not for low latency under thousands of concurrent users, so customer dashboards should be served from precomputed aggregates in an operational store or from a real-time OLAP engine such as ClickHouse, Druid or Pinot. The design needs explicit freshness and latency SLOs and a cost per request, isolation so internal analytics can never slow customer features, and per-tenant access control enforced in the serving layer.
What to remember
In this answer, we saw why product features should not query the analytics warehouse directly: it is tuned for throughput rather than low latency and high concurrency, and its cost per query and shared resources become risks at product traffic. We designed a serving layer of precomputed aggregates in an operational store or a real-time OLAP engine such as ClickHouse, Druid or Pinot, with written freshness and latency SLOs and a cost per request, isolation from internal analytics, and tenant access control enforced both in the API and in the store.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
I would not let product features query the analytics warehouse directly. Warehouses are built for throughput on large scans, not for low latency under thousands of concurrent users, so customer dashboards should be served from precomputed aggregates in an operational store or from a real-time OLAP engine such as ClickHouse, Druid or Pinot. The design needs explicit freshness and latency SLOs and a cost per request, isolation so internal analytics can never slow customer features, and per-tenant access control enforced in the serving layer.
Why this question is asked
Once a company has good data in its warehouse, product teams naturally want to show some of it to customers: a merchant's sales dashboard, usage statistics, or a monthly report. Pointing the product at the warehouse looks like the quickest path, and it often works in the demo with three users. Interviewers ask this design question because the production version fails in predictable ways, and an architect should see them before approving. In this answer, we will look at why warehouses struggle with user-facing load, then design the serving architecture: precomputed aggregates or a real-time OLAP engine, SLOs and cost, workload isolation, and tenant access control.
1Why the Warehouse Is the Wrong Serving Layer
Analytical warehouses are optimised for a few heavy queries: scanning billions of rows across many cores, where a query that takes three seconds is fast. Customer-facing features have the opposite profile: thousands of small, similar queries, each expected in under a few hundred milliseconds, with traffic peaks when customers log in on Monday morning.
Several things go wrong when we combine them. Latency: even a small warehouse query often has hundreds of milliseconds to seconds of overhead for planning, queuing and scheduling, before it reads any data. Concurrency: many warehouses limit how many queries run at once per compute cluster and queue the rest, so a burst of 2,000 customers opening dashboards becomes a queue. Cost: a per-query or per-compute-second model that is fine for analysts becomes very expensive at product traffic, for example 50,000 dashboard loads a day, each scanning a few gigabytes. And reliability: warehouse maintenance, a heavy analyst query or a slow nightly rebuild now affects customers directly.
2Option A: Precompute Aggregates Into an Operational Store
Most customer dashboards show a small set of known numbers per tenant: sales per day, top products, orders per status. These can be computed in the warehouse as part of the regular pipeline and pushed into a store built for fast lookups, such as PostgreSQL, a key-value store or a cache. The product then reads a few rows by tenant and date, which takes milliseconds.
This is the simplest and cheapest pattern and covers most dashboards. Its limits are flexibility and freshness: customers can only see the aggregates we precomputed, and data is as fresh as the last export, typically minutes to an hour.
3Option B: A Real-Time OLAP Engine
When customers need flexible filtering, such as slicing their sales by any combination of product, channel and region, or data fresh within seconds, precomputed tables become unmanageable. Real-time OLAP engines such as ClickHouse, Apache Druid and Apache Pinot are designed for this: column-oriented storage tuned for low-latency queries, ingestion straight from Kafka within seconds, indexes and pre-aggregation options, and high query concurrency. They serve user-facing analytics at many large companies.
They are another system to run, with their own operational skills, so we choose them when the product's needs justify it, not by default. Data reaches them from the same CDC or event streams that feed the warehouse, so both see the same source of truth.
- Product UI and APIauthenticates the user, passes tenant id
- Serving layeroperational store or real-time OLAP engine
- Precompute or stream ingestionwarehouse jobs or Kafka consumers
- Events and CDCfrom the services' databases
- Analytics warehouseinternal analysis, isolated from customers
5 layers, from the top down. Step through them one at a time.
4SLOs and Cost per Request
Before choosing, we write down what the feature promises, because the numbers decide the architecture. A freshness SLO says how old the data may be, for example 99 percent of dashboards show data less than 15 minutes old. A latency SLO says how fast queries must return, such as 95th percentile under 300 ms. A throughput estimate says how many requests we expect at peak, such as 200 per second.
We then estimate the cost per request for each option. If a warehouse query costs about a cent in compute and dashboards issue 10 queries per load, 50,000 loads a day are about 5,000 dollars a day, which ends most debates. A precomputed lookup in PostgreSQL costs a tiny fraction of that. Writing the cost down early prevents a successful feature from becoming a budget crisis.
5Isolation and Per-Tenant Access Control
Customer features and internal analytics must not share resources. If they do, an analyst's heavy query on Monday morning slows every customer dashboard, and a customer traffic spike blocks month-end reporting. With the serving layer separate, the warehouse can be resized, maintained or even down for an hour without customers noticing, because they read from the serving store.
Access control moves to the serving layer too. In a warehouse, analysts often have broad access; in a product, each customer must see only their own data, and a single bug that drops the tenant filter is a data breach. So the serving API derives the tenant id from the authenticated session, never from a request parameter, and the store enforces it as well, for example with PostgreSQL row-level security or a mandatory tenant filter in the query layer.
Notice that RLS policies do not apply to table owners or superusers by default, so the serving API must connect as an ordinary role. The two layers together, tenant from the session and a policy in the store, mean one mistake does not expose another customer's data.
6Follow-up questions
Could we use a separate warehouse compute cluster just for the product?
That fixes isolation but not latency, concurrency limits or cost per request. It can be a reasonable first step for a low-traffic feature, such as a monthly report export, with a plan to move to a serving store when traffic grows.
How do you keep the serving layer consistent with the warehouse numbers?
Both are built from the same events and the same metric definitions, ideally from the same transformation code. We reconcile daily totals between the two and alert on differences, and we show customers when the data was last refreshed.
What if a customer asks for raw data exports?
Large exports are a batch job, not a dashboard query. We generate them asynchronously from the warehouse, with the tenant filter applied by the job, store the file in object storage and notify the customer with a time-limited download link.
7Conclusion
In this answer, we saw why product features should not query the analytics warehouse directly: it is tuned for throughput rather than low latency and high concurrency, and its cost per query and shared resources become risks at product traffic. We designed a serving layer of precomputed aggregates in an operational store or a real-time OLAP engine such as ClickHouse, Druid or Pinot, with written freshness and latency SLOs and a cost per request, isolation from internal analytics, and tenant access control enforced both in the API and in the store.
Open with
I wouldn't approve product features querying the warehouse directly. Warehouses are tuned for throughput on big scans, a few heavy queries, while a customer dashboard means thousands of small queries that need answers in a few hundred milliseconds.
Then, if they want more
Warehouses add planning and queuing overhead, limit concurrency per cluster, and charge per query or compute time, so at product traffic it gets slow and expensive, and an analyst's heavy query would slow customers. Instead I'd add a serving layer.
For most dashboards, precompute aggregates in the warehouse pipeline, like daily sales per merchant, and export them to an operational store such as PostgreSQL keyed by tenant and date, so a dashboard reads thirty rows in milliseconds.
If customers need flexible slicing or data fresh within seconds, I'd use a real-time OLAP engine like ClickHouse, Druid or Pinot, fed from the same Kafka streams. Before choosing, I'd write freshness and latency SLOs and estimate cost per request. The serving layer isolates customers from internal analytics.
And tenant access control lives there: the API takes the tenant from the authenticated session, and the store enforces it too, for example with row-level security, so one bug doesn't leak another customer's data.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- PostgreSQL documentation, MySQL reference manual
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Teams want to query the warehouse from user-facing product features (for example...": https://scrivio-interview-library.netlify.app/databases/analytics-and-cdc/5a56c78aff/