The prototype became production: when the data tier can't carry reporting and AI
Most federal systems I've worked on didn't start with a data architecture. They started with a small team of developers, a few months of prototype money and a demo date. That's how it should work. Prototype funding pays for proving the idea, and nobody should spend it on a data platform for a system that might not survive the demo.
The trouble starts when the prototype succeeds.
How the data tier turns into debt
The pattern is so common it's almost a lifecycle:
- The prototype. One database, usually Postgres, designed by whoever wrote the first API. Tables mirror the screens. There's no DBA on the team, because there didn't need to be.
- The prototype becomes the program. For DoD work, this is often literal. Under 10 U.S.C. 4022(f), an Other Transaction prototype that's "successfully completed" can go straight to a follow-on production award without another competition. Fast, and that's the point, but the prototype's schema becomes the production schema by contract. Nobody budgeted a redesign, because nothing was ever "redesigned".
- Reporting shows up. Leadership wants dashboards. Someone points a BI tool at the production database. Month-end reports now compete with the users the system was built for.
- Analytics and AI show up. Data scientists want five years of history. An AI assistant gets wired in that generates SQL against the live tables, or a retrieval pipeline re-reads half the database every night to build embeddings. Each one is a new workload the original design never imagined.
By stage four, one database is doing four jobs: transactions, operational reporting, historical analytics and AI. It does none of them well, and the symptoms land on the people with the least power to fix them: the users and the on-call DBA.
None of this is a developer failure. The prototype did exactly what it was paid to do. The debt comes from never paying for the transition.
Signs you've hit the wall
You don't need a consultant to tell you. Look for:
- Slow at predictable times. The system is fine at 7 a.m. and miserable at 9, or at month-end, or right after the nightly AI job kicks off.
- Long-running queries from non-application accounts. Reporting tools, notebooks and service accounts running queries measured in minutes, on the primary.
- Every new requirement is an index. Each dashboard adds two indexes, write performance slowly drops, and nobody knows which ones are still used.
- History is the hot data. Ninety percent of the database is old records that only reports and models read, but every backup, restore, vacuum and upgrade pays for all of it.
- "Can I get a copy of the database?" comes up every week. When the only way to give someone data is a full copy, people make copies, and every copy of CUI is another thing to track for your ATO.
On Postgres, a quick look at who's running long queries right now tells you a lot:
SELECT usename, application_name,
count(*) AS active,
max(now() - query_start) AS longest
FROM pg_stat_activity
WHERE state = 'active'
AND backend_type = 'client backend'
AND now() - query_start > interval '30 seconds'
GROUP BY usename, application_name
ORDER BY longest DESC;
If the top rows are your BI tool, a notebook server or an AI service account rather than the application, you've found your problem: it isn't the database, it's the mix.
Fix what's cheap first
A lake or warehouse isn't the first step, and it doesn't fix a bad schema. Copy a messy model into a lake and you get the same mess in more places, plus a pipeline to maintain. Before you build anything new:
- Give each workload its own account. Separate roles for the application, reporting, analytics and AI. You can't manage what you can't tell apart, your auditors will want to see it anyway and your STIG will keep demanding it.
- Set limits per role. A
statement_timeouton the reporting and AI roles keeps one bad query from holding locks and connections for an hour. - Add a read replica for reporting. It moves the read load off the primary for the cost of one more server. It doesn't help with history or heavy aggregation, but it buys time.
- Partition and archive history. If ten years of records sit in one table, partition by time so that current work only touches current data.
- Fix the worst queries and the worst tables. A week of tuning often buys a year.
- Write down the data model. A data dictionary and an entity diagram cost little, and every later step depends on them. Make them a contract deliverable if they aren't already.
When one primary really isn't enough: sharding
Sometimes the problem isn't the mix. The transactional load itself (writes, rows, connections) has outgrown the biggest server you can get approved. That's when sharding comes up: splitting the data across several databases by a key, so each one holds a slice.
- Citus turns Postgres into a distributed database as an extension. You pick a distribution column (an agency, tenant, program or region ID), and tables are spread across worker nodes. It's open source, builds from source, and fits an air-gapped site as well as Postgres itself does.
- Application-level sharding means one database per agency, tenant or region, with the application deciding where each request goes. It's simple to reason about, and it lines up neatly with data that has to stay separated anyway.
- Oracle has its own built-in option (Oracle Sharding, now called Globally Distributed Database), if Oracle is your system of record.
Sharding works when there's a natural key that almost every transaction includes, so most queries touch one shard. It's the wrong answer when the pressure is reporting, analytics or AI:
- Reports are cross-shard by nature. "Totals by month across every agency" touches every shard. Citus can run that in parallel, and for real-time dashboards on current data it does it well. But it's still the same cluster serving your transactions, and history still lives on your most expensive storage.
- Application-level sharding makes reporting harder. Every report now has to gather from N databases, and that's usually the moment someone builds a lake anyway. Application sharding also siloes data, requires a code-first approach, and ends up fighting the database itself.
- It's a one-way door. Picking the shard key is a schema decision you live with for years. Getting it wrong costs more than the problem it solved.
So shard for transaction volume, and move analytics out for analytics load. Plenty of systems end up doing both, sharding the operational tier and feeding one lake from all the shards.
When a lake or warehouse is the right next step
Move the analytics out when one or more of these is true:
- More than one team consumes the data in ways the application team doesn't control: BI, data science, AI, other programs.
- History is large and mostly read-only, and keeping it in the transactional database makes backups, upgrades and recovery slow.
- The AI work needs whole-table scans, for training sets, evaluation sets or batch embedding jobs.
- You need the data in more than one place, such as on-prem and an authorized cloud region, or on two classification levels.
- People keep asking for copies. One governed copy, with access control and an audit trail, is better than twenty ungoverned ones.
Warehouse or lake? A warehouse is modeled, cleaned data built for SQL reporting. A lake keeps raw and historical data in open files for many engines. With open table formats like Apache Iceberg, the line has mostly blurred: you can keep raw change data and modeled reporting tables in the same lakehouse and query both with one engine. I wrote up the components, the Oracle alternatives and the federal and air-gapped details in From a Postgres cluster to a hybrid lakehouse, so I won't repeat them here.
Where the AI workload belongs
"AI" isn't one workload, and it doesn't all belong in the lake:
- Training data, evaluation sets and batch feature jobs belong in the lake. They scan a lot, they want history, and they shouldn't run on the primary.
- Retrieval for a live assistant (looking up a few relevant records or documents per question) needs low latency and current data. It usually belongs in a small serving store next to the application, such as Postgres with a vector extension, fed from the system of record, not in the lake.
- AI that writes SQL should never point at the primary. Give it a read-only role on a replica or the lakehouse, with a statement timeout, a row limit and logging. OMB's current guidance on agency AI use (M-25-21) expects agencies to manage risk on high-impact uses, and "the model ran an unbounded query against production" is not a story you want to tell.
The federal part: budget and ATO
Two things make this harder in government than in industry:
- The money. Prototype work is usually paid from research and development funds, while sustainment comes from operations and maintenance. Re-architecting the data tier falls between the two, so it often doesn't get funded at all. Put the data transition in the follow-on plan explicitly, as its own line with its own deliverables, before the prototype ends.
- The ATO. A prototype may run under a limited or conditional authorization. Production needs the full package, and every new data store, pipeline and copy goes into the boundary. A lakehouse that holds the same CUI as the source is categorized at the same level. Plan the data flow diagram and data categorization before you build, not after the assessor asks.
A short checklist for the program
- Separate accounts and limits for every workload, starting this sprint.
- A data dictionary and model as a deliverable.
- A read replica before the first dashboard goes live.
- Sharding only if transaction volume, not reporting, outgrows one primary, and only with a shard key nearly every transaction carries.
- Time-based partitioning on anything that grows forever.
- A written trigger for moving analytics out (number of consuming teams, size of history, AI scan load), so it's a planned step and not an emergency.
- The data transition funded in the follow-on, with the ATO impact mapped.
If you've moved a prototype's database into production on a federal program, I'd like to hear what you'd do differently. My guess is "get a DBA in earlier", but I'm biased.
Brett Rosenblatt is a DBA and performance engineer and a co-founder of Bandlei, which makes ReinDB, a read-only performance monitor for PostgreSQL, Oracle and other databases.