Case study
It works. That does not mean it holds up.
Eleven months, almost 3,000 commits, built with AI assistants. The result is a data platform that runs in production for 27 brands. In its current form, it won’t carry hundreds of accounts. How I found out, and which infrastructure comes next.
At a glance
-
It runs.
Built with AI assistants in eleven months, in production for 27 brands.
-
It doesn’t hold up.
A single database does almost everything, and the same data goes through it again and again. That isn’t made for hundreds of accounts.
-
There is a plan.
Two days of analysis with AI agents and counter-tests. What came out of it is a target infrastructure with separate services, plus a cost estimate.
Built at the pace of AI.
In November 2025, a founder starts on a prototype. He builds it with AI assistants. Four out of five commits name one of them as author or co-author. Eleven months later, 27 brands use the platform to analyse their advertising and sales and to steer their bids.
- 2,944
- commits in eleven months
- 81%
- of non-merge commits with an AI assistant as author or co-author
- 680,000
- lines of code in TypeScript, SQL and scripts
- 165
- deployed serverless functions
- 308
- tables and 317 SQL functions in the database
- 226
- entries for background work
Excluding merges, 1,940 of 2,388 commits name an AI assistant.
Commits per month
- November 2025: 43 commits
- December 2025: 18 commits
- January 2026: 7 commits
- February 2026: 33 commits
- March 2026: 183 commits
- April 2026: 68 commits
- May 2026: 364 commits
- June 2026: 188 commits
- July 2026: 433 commits
- August 2026: 466 commits
- September 2026: 648 commits
- October 2026: 493 commits
- Nov 2025 First commit; two days later a local version runs
- Jan 2026 First data pull from the marketplace goes live
- Feb 2026 Daily sync, first database migrations
- Sep 2026 Peak with 648 commits in one month
The curve shows the pace AI assistants make possible. From May 2026, well over a hundred changes land every month, 648 in September. New requirements end up wherever they’re quickest to solve at the time. Sometimes as a serverless function, sometimes as an SQL function in the database, sometimes as one more schedule.
Background work in six places
For a product at this stage, that’s the right order. First you need features customers actually use. Before the next growth step, though, a second question comes up: which parts can carry many times today’s data?
Working is not the same as viable.
Every feature does what it should. The tests are green and customers work with it. That’s exactly why nobody notices the setup isn’t made for the next stage of growth.
“Just because everything works does not mean a solution is viable. AI is reluctant to tell you that.”
-
AI solves the task it is given
An assistant builds the next feature so it works today. Whether it still holds at a hundred times the data is rarely part of the task. It hardly ever brings that up on its own.
-
Every fix lands in the nearest place
New requirements get solved wherever it is quickest at the time. After eleven months, background work is spread across six places.
-
Load grows quietly
With 27 brands, the database is small and fast enough. In day-to-day use, nobody sees that it writes eighteen times its size in five weeks.
27 GB stored. 494 GB written.
At 27 GB, the database is small. What gets expensive is how often the same data is read, written and recalculated.
- 26.4m
- SQL calls in just over five weeks
- 155 h
- execution time in the database
- 494 GB
- write-ahead log, a little more than 18 times the database
Write-ahead log per data path
Execution time per data path
Three patterns that keep coming back
-
1.38m Two approximations with different definitions. They show the order of magnitude, not an exact ratio.
Reports are loaded several times
Values for past days still change afterwards. So overlapping periods are requested and imported again and again, around 1.38 million report rows a day. In the stored data, one day equals roughly 71,000 fact rows.
-
6.5m Object observations per day.
Reconciliation also writes what did not change
Around 1.63 million campaign objects are reconciled four times a day. For known objects, the database rewrites every delivered column, even when nothing changed. Negative keywords alone account for 73.6 GB of write-ahead log.
-
175.6 GB Temporary data during rebuilds.
Whole windows are recalculated
Derived market metrics are deleted per scope and rebuilt from scratch. That produced 175.6 GB of temporary data. Roll-ups read up to 60 days every time.
What the team had already improved
- Paging by key instead of by offset
- Imports as set operations in the database instead of many single calls
- Complete campaign reports skip unchanged rows
- Nightly import: 998,000 rows in 12.4 minutes with four writers
- Faster read paths for the bid calculation
The analysis builds on this. Part of the cumulative load dates from before these changes.
And with hundreds of accounts?
The analysis deliberately thinks big: 100 customers, each with the data volume of all of today’s customers combined. That shows which part hits its limit first.
| Metric | Today | 100 times |
|---|---|---|
| Active brands | 27 | 2,700 |
| Campaign objects | 1.63m | 163m |
| Object observations per day | 6.5m | 653m |
| Report rows per day | 1.38m | 138m |
| Database in its current form | 27 GB | 2.7 TB |
Today, one relational database does almost everything: permissions, campaign inventory, imports, roll-ups, analytics and bid calculation. At this volume, all of these tasks compete for the same resources, and every repetition grows with them.
In my assessment, the setup won’t carry hundreds of accounts in this form. More hardware pushes the limit out, but the repetition stays.
On top of that come the marketplace’s limits
Quotas apply per application and operation. New servers, extra IP addresses or copied credentials don’t create more capacity. Some report types allow only about one call per minute once a small burst is used up.
An example with documented values
Two days, five steps.
The analysis consists of an inventory, parallel specialist reviews by AI agents and executable counter-tests. I didn’t change anything in production.
-
Step 1: Take stock
Functions, tables, jobs, callers and dependencies. I queried the production database read-only, each query with an eight-second time limit. The scripts ship with the report, so the team can rerun the measurements on their own later.
Result: A complete map of all functions, tables and jobs
-
Step 2: Map the load
Query statistics, write-ahead log and volume drivers such as brands, marketplaces and campaigns. I kept apart what is stored, what gets processed over and over and what actually grows.
Result: A load map per data path
-
Step 3: Design the target
Control, history, computation and analytics as separate jobs. Plus a cost model as a spreadsheet with visible assumptions and three cases.
Result: Architecture and cost estimate
-
Step 4: Check against real features
Three AI agents independently compared reports, bidding logic and operational features with the design, every claim with a reference into the code. Counter-tests ran on isolated PostgreSQL and ClickHouse instances with synthetic data.
Result: 520 existing tests and 40 new probe groups passed
-
Step 5: Clarify external limits
Quotas, approvals and data availability of the marketplace, checked against the official documentation. Along the way, I came across a new change stream from the provider.
Result: A list of the evidence still open with the provider
Every job in its place.
Today, control, history, computation and analytics all run through one database. The design separates them. A change only recalculates the results it actually affects.
-
Intake
Connectors and job control
Reports and changes from the marketplace, with shared quota control and priorities per customer.
-
Valid data state
Object storage, Parquet, Iceberg or DuckLake
Original reports and versioned detail history. Cheap, immutable and rebuildable at any time.
-
Computation
Workers with DuckDB
Preparation and targeted recalculation of affected slices. Scales independently of the rest.
-
Analytics
ClickHouse or StarRocks
Detail queries and matching pre-aggregates for the app, exports and bidding logic.
Control
PostgreSQL
Permissions, configuration, current campaign inventory, jobs, dependencies and published versions.
What happens on a change?
Unchanged report
- Input
- The same content arrives again
- Work
- Compare with the valid state
- Result
- No new version
The report still has to be downloaded and parsed. But thanks to the comparison, there are no new values and no follow-up calculations.
Involved: Intake, Valid data state
100 becomes 120
- Input
- Value of an old day: 100 → 120
- Work
- −100 and +120, or replace the slice
- Result
- New value: 120
For an additive metric, the net contribution is +20. For medians and shares, a targeted rebuild of the slice is more reliable.
Involved: Intake, Valid data state, Computation, Analytics
Product changes group
- Input
- A product is moved to a new group
- Work
- Refresh affected historical joins
- Result
- New group totals
The raw values stay the same. Because reports group by today’s assignments, old values have to show up in the new group. A small change can touch many rows.
Involved: Control, Computation, Analytics
Delete before old update
- Input
- Version 12 deletes, version 11 arrives later
- Work
- Keep the tombstone, ignore version 11
- Result
- The record stays deleted
The highest version per key wins. Arrival time and file name are not a reliable order.
Involved: Intake, Valid data state, Computation, Analytics
Marketplace throttles
- Input
- The interface reports: limit reached
- Work
- The job waits for free quota
- Result
- No pointless scaling up
More workers don’t change the limit. Other customers and sources keep working in the meantime.
Involved: Intake, Control
Rebuild aborts
- Input
- New results are only partly written
- Work
- The previous publication stays valid
- Result
- No half-old, half-new report
New states are built and checked in full, then made visible with a pointer switch. Running reports keep their state.
Involved: Valid data state, Computation, Control, Analytics
-
A new change stream
Since autumn 2026, the provider has been delivering changed advertising data as files with version numbers, corrections included. That can replace part of the repeated report pulls. Before it can, every current feature needs a proven data path, because the stream groups some details together.
-
A deadline that comes anyway
According to the provider, the current reporting interface is due to be retired in mid-2027. So a successor is needed either way, rebuild or not.
Deliberately not in the first step
- A rewrite in Rust or sharding the database. Neither removes repeated pulls or wrong totals.
- A dedicated streaming database, as long as no feature needs the extra freshness.
- A separate cluster per customer. It isn’t needed at the scale examined.
- Two analytical databases. ClickHouse and StarRocks are compared on the same data, then one stays.
Services that grow separately.
The goal was an app that grows with its customers. So the design also separates the services that answer requests. Each gets its own resources and scales by its own bottleneck.
Target infrastructure
App and exports
Users, agencies, shared reports
Shared API entry point
Kubernetes cluster in an EU cloud
Requests
-
Identity
Keycloak
Login, password, MFA, sessions
-
Core API
Go
Permissions, settings, change requests
-
Analytics API
separate deployment
Dashboards, filters, drill-downs
Background
-
Query workers
own pool
Large exports and analyses
-
Import and compute workers
Python with DuckDB
Preparation, targeted recalculation
-
Bidding workers
own queue
Time-critical decisions
-
Connectors
shared quota control
Pulls and changes at the marketplace
Operations
-
Observability
Prometheus, Grafana, Loki
Metrics, logs, backlog per queue
-
PostgreSQL
Two shards with three copies each
-
Analytical database
Two shards with three copies each
-
Object storage
With a copy at a second location
Outside the cluster
-
Workflow engine
Managed service
Multi-step workflows, resumption, priorities
-
Marketplace
Interfaces and change stream
Delivered to cloud storage chosen by the provider
Servers in the cost model: 30, up to 38 at peaks
- 3 Cluster control plane
- 3 API, identity, connectors
- 8 + 8 Import and compute workers
- 2 Bidding workers
- 6 PostgreSQL
- 6 Analytical database
- 2 Observability
Four paths for requests
| Service | Tasks | Operation | Scales by |
|---|---|---|---|
| Identity service | Login, password reset, MFA, sessions | Own resources with protected minimum capacity | Sign-ins, independent of analytics |
| Core API | Users, permissions, settings, saved views, accepting change requests | Short requests, small responses, operational database | Load and response time, within the database connection limit |
| Analytics API | Dashboards, tables, filters, drill-downs | Pre-aggregates, cache or bounded detail queries | Concurrent requests and memory |
| Query workers | Large exports, special analyses, historical analysis | Durable jobs with bounded parallelism | Runnable backlog and wait time, capped by the database |
Large analyses run as jobs
-
Accept
The analytics API checks permissions, filters and data version, stores the job and replies at once with a job ID.
-
Run
A query worker computes as soon as the budget has room. Identical requests are merged.
-
Fetch
The app shows the status and loads the finished result, large exports straight from object storage.
That way a long analysis doesn’t hang on an open connection. Reloading the page or losing the connection doesn’t stop it.
Separate services alone are not enough
If the analytics API and the query workers draw on the same unbounded database resources, one large export still slows down every dashboard. So you also need:
- Separate deployments and connection pools, so analytics cannot take all connections or the memory of the core API
- Budgets inside the analytical database for reports, exports, imports and bid calculation, for example via workload scheduling or resource groups
- An admission limit across all instances: more API pods do not automatically start more heavy queries
- Fair distribution between customers, so one export cannot take the whole analytics capacity
- Cancellations passed through to the database, so nothing keeps computing out of sight
In an asynchronous runtime, a waiting query doesn’t block a whole process. It does hold connections and memory, though. The separation mainly protects availability and resources. It doesn’t reduce the computation itself.
Who controls what
- Kubernetes
- Places the services on separate server groups, restarts them, rolls out new versions and keeps copies on different hosts via anti-affinity. Workers scale automatically by runnable backlog, for example with KEDA and Prometheus metrics.
- Workflow engine
- Runs multi-step workflows with resumption and distributes work by priority and fairly across customers. Its history only holds references to data, no reports.
- The application
- Decides business order, data version, permissions and how to handle the marketplace quotas. No infrastructure takes that off its hands.
To start, one repository with separately deployable services and worker pools plus a single cluster is enough. You don’t need separate domains or a cluster per customer for that.
Tested against real code.
An architecture diagram never argues back. So I ran the design against the real code and against real databases.
- 520
- existing tests from 28 files passed
- 40
- new probe groups, ten of them on real database instances
- 0
- changes to production
One example anyone can follow: the marketplace corrects values for past days after the fact. An architecture that precomputes totals has to be able to replace the old contribution.
One value, four deliveries
Correction
Input 100, then a complete report with 120
The new complete state replaces 100 with 120. Simply adding counts both deliveries.
Duplicate delivery
Input 100, then 120, then the same 120 again
If the same correction arrives twice, the state stays the same. Appending blindly gives 100 + 120 + 120.
Report failed
Input State 120, then a failed report
A failed report replaces nothing. Reading missing values as zero deletes correct numbers.
Confirmed empty
Input State 120, then a complete, explicitly empty report
A confirmed empty report sets the scope to zero. If old rows aren’t removed, the 120 stays.
A correction to my own design
My first draft mostly kept condensed totals. Checking it against the code showed that isn’t enough. Search terms, custom date ranges and year-on-year comparisons need detail data, and a twelve-month report with a year-on-year comparison reads up to two years. So the plan now keeps around 25 months of detail history in the analytical database.
What growth would cost.
The cost model calculates a deliberately large scenario: 100 customers, each with the data volume of all of today’s customers combined.
- 791m
- work units per day: 653 million object observations and 138 million report rows
- 30 VMs
- permanently, up to 38 with extra workers for peaks
- about €10,000
- per month net including a 20% buffer, roughly €100 per customer
VMs needed by compute time per work unit
- 0.5 ms: 27 VMs, of which 5 workers
- 1 ms: 30 VMs, of which 8 workers (Base assumption)
- 2 ms: 37 VMs, of which 15 workers
- 3 ms: 44 VMs, of which 22 workers
The biggest unknown is the compute time per record. It moves the result more than any price list. So it gets measured with real data before any commitment.
The model’s three cases range from €7,705 to €14,867 per month.
Object storage for all copies is only about €53 a month of that. The money goes into compute and reliable workflow orchestration.
What the analysis does not prove.
The result is a solid basis for a decision. Nothing has been migrated yet.
Proven
- Where the load comes from, with query statistics and references into the code
- That the target design can cover the examined features
- That corrections, duplicates and aborts can be handled with clear rules, at least in a bounded trial
- Which limits the marketplace sets and how to clarify them
Still open
- Measured savings and a load test at 100 times the volume
- Identical results from the old and new system across all reports
- Approvals and the quotas actually granted by the provider
- Failure, recovery and permission checks across the full system
- Runtime figures of the job server, which could not be accessed during the analysis
The next step: a narrow, real end-to-end slice
- Marketplace report
- Immutable source
- Correctable facts
- Published report
- Frozen bid decision
The bid decision runs without making changes at the provider. The measurements cover changed keys per row read, bytes read and written, compute time, the time to a consistent publication and the duration of a full recovery.
What other teams can take from this.
-
Working is not proof
Green tests and happy customers show that the software runs today. Whether it carries ten or a hundred times as much only shows when you test for exactly that.
-
Ask AI what it won’t tell you on its own
An assistant answers the question you ask. Ask explicitly about load, growth and operations, and have the answer checked.
-
Measure before you rebuild
At 27 GB, the database was small. A rewrite in a faster language or sharding would not have removed any of the bottlenecks found.
-
Separate early what grows differently
Sign-in, everyday use, analytics and background work grow at different speeds. Once they’re separate, each part can scale by its own bottleneck.
-
Check before growth arrives
An analysis before growth can be planned. A rebuild under load cannot.
Your product works. Does it hold up?
In the tech check, I read your code and review architecture, data model, access control and operations. You get in writing what holds and what is needed before the next step.
Sources and background
- Martin Kleppmann: Turning the database inside-out (2015) (opens in a new window)
- Kleppmann, Riccomini: Designing Data-Intensive Applications, 2nd edition (opens in a new window)
- ClickHouse: Incremental Materialized Views (opens in a new window)
- Apache Iceberg: Reliability (opens in a new window)
- DuckDB 2.0 (opens in a new window)
- StarRocks: Primary Key Table (opens in a new window)
Anonymised: product, customer and provider names have been removed. All figures come from the analysis of 27 and 28 October 2026 and from the project’s version history.
As of 28 October 2026