Don't Run Analytics on Your Operational Database
Your production database is built to serve your app: many small reads and writes, each finished in milliseconds. Analytics asks the opposite: few queries, each reading millions of rows. Running both on the same database slows the app, holds back its housekeeping, and still gives you numbers that are hard to trust.
It starts with one report
Someone needs last month's revenue by country. The data is in the production database, the query takes a minute to write, and it works. Then it goes into a dashboard that refreshes every 15 minutes. Then finance gets a login. Then an AI tool is connected "just to read". A year later, checkout slows down every Monday morning and nobody connects it to the weekly report.
Nothing here was a bad decision on its own. The problem is the database was never built for this kind of work.
Two different jobs
| Your app (operational) | Analytics | |
|---|---|---|
| Typical query | Read or change one order | Sum every order of the last two years |
| Rows per query | A few | Millions |
| What matters | Milliseconds, many users at once | Full scans, joins and grouping |
| Data it keeps | The current state | History: what it was, and when |
| Storage built for | Whole rows, through indexes | A few columns over many rows |
An operational database is tuned for the left column. Every analytics query is a request it can serve, but at a cost it pays from the same CPU, memory and disk your customers are waiting on.
What actually goes wrong
1. Your app gets slower
A report that scans a large table competes with checkout for CPU and disk, and pushes the app's frequently used data out of memory. The app then reads from disk what it used to find in memory. The slowdown shows up in the app, not in the report, which is why it is hard to trace.
2. Long queries hold back the database's housekeeping
Databases like PostgreSQL and MySQL keep old versions of changed rows for as long as a running query might still need them. A report that runs for 20 minutes keeps every row changed in those 20 minutes. In PostgreSQL, VACUUM cannot remove them, and the PostgreSQL documentation warns not to let long-running transactions hold back its cleanup for long. In MySQL, the same effect shows up as a growing history list. Either way, tables and indexes grow, and every query gets a little slower.
3. Reports can block your deployments
A schema change, such as adding a column, needs a lock on the table that waits for running queries to finish. While it waits, new queries on that table queue behind it. A long report plus a routine migration can stop every request to that table until the report ends.
4. The numbers are hard to trust
An operational table holds the present. When an order's status changes from "pending" to "shipped", the old value is gone, so "how many orders were pending last Friday" has no answer. And because the data changes while a long report runs, two reports run ten minutes apart can disagree, both correctly.
5. Too many people hold production credentials
Every dashboard, analyst, spreadsheet and AI tool that reads production needs a login to it, and usually sees every table, personal data included. Each one is another way in.
"We'll use a read replica"
A replica takes the load off the primary, which helps. It does not change what the database is
built for, and it brings its own trade-off. On a PostgreSQL replica, a long query can be
cancelled when the changes it reads are replayed from the primary. Turning on
hot_standby_feedback stops most of those cancellations by telling the primary to
keep old rows, which brings back the cleanup problem from point 2, on the primary. The replica
also has the same tables, the same row storage and no history.
A replica is a reasonable first step. It is not an analytics database.
What to do instead
- Read production once, on a schedule. A read-only user copies what analytics needs, ideally only what changed since the last run, at a time your app can afford it.
- Store it where analytics is cheap. A separate database or warehouse, sized and indexed for large scans, where a heavy query slows nobody's checkout.
- Keep the history. Snapshot or append changes, so "what was it on Friday" has an answer.
- Model it for questions. Clean names, joined tables and metrics defined once, so dashboards and AI tools read business terms instead of app tables.
- Point every reader at the copy. Dashboards, analysts and AI tools get access to the analytics store, with permissions per team or customer. Production credentials stay with the app.
Signs you have outgrown it
- The app slows down at the same time every day or week.
- Someone asks you to "not run reports during business hours".
- A migration waited for a report to finish.
- Two dashboards show different numbers for the same day.
- Nobody can say what a number was last month, only what it is now.
- An AI tool or BI service holds production credentials.
One of these is a warning. Two or more usually means analytics already costs you more on production than a separate store would.
How BI.P.EYE does it
BI.P.EYE connects to your database with a read-only user and reads only the tables and columns your pipelines need, on the schedule you set. Each run writes to a warehouse built for analytics: ours, or your own Postgres, Snowflake or with upsert so rows are updated rather than copied again. Dashboards, the dashboard chat, embedded analytics and Claude all query that warehouse, never your production database.
Already reading from production? Start with the heaviest dashboard: move its data into a scheduled pipeline, point the dashboard at the copy, and watch the app's response time at the hour it used to refresh.