wedosoftware logo
Insights

Before you leave PostgreSQL: how far a well-tuned Postgres really goes

Many teams abandon PostgreSQL too soon. Set up properly, it handles over 100 million inserts a day with flexible queries on top, and it costs nothing in licences. What a proper setup involves.

Key takeaways

  • A well-tuned PostgreSQL can take over 100 million inserts a day and still answer flexible queries.
  • It is open source and free: no licence fees, no lock-in and no vendor who can change the terms.
  • Most of the speed comes from partitioning, batched writes, deliberate indexes, gradual data removal and keyset pagination.
  • Cassandra or a cache is worth adding only for specific workloads; most datasets can stay in Postgres for good.

As data grows, the usual reflex is to swap PostgreSQL for a specialised distributed database. In our experience that step usually comes too soon.

This is not a lab benchmark. Set up properly, PostgreSQL handles over 100 million inserts a day in production, with an even bigger read load on top, and stays calm doing it. Those reads can be flexible queries too: filters on different fields, time ranges, combinations nobody foresaw. Not just the narrow “get one row by its key” pattern that key-value stores are designed for, and that most headline throughput figures quietly rely on. None of this takes exotic tricks, just a database configured for the job.

What years of high-load work have taught us: a well-configured PostgreSQL meets the vast majority of needs, including many that teams assume require something else. And it does so without licence costs.

Open source, and free for the long run

PostgreSQL is truly open source, under a permissive licence, and developed by an independent community rather than owned by one vendor. In practice that means:

  • No licence fees, no per-core pricing and no surprise audits. Another replica or environment costs only the hardware underneath it.
  • No lock-in. It runs the same on your own servers, in Kubernetes or in any cloud, and every major provider sells it as a managed service. You can move whenever you like.
  • No sudden licence changes. Since no single company owns it, nobody can relicense it or lock features behind a paywall.
  • A large ecosystem of free extensions, tools and experienced engineers, pgvector among them for vector search for AI agents.

The money a commercial database would take in licences is better spent on the hardware and expertise that actually make a system fast.

Why Postgres makes a sound default

  • Transactions and consistency you never have to work around.
  • Flexible queries. Next year’s business question does not have to be built into today’s tables.
  • Mature tooling for backups, replication, monitoring and migrations, and plenty of people who know it.
  • One system to operate instead of several, which counts for more in reliability than any benchmark.

Every extra database is one more thing to run, secure, back up and understand at three in the morning. Pay that price only when it buys something real.

What a proper setup looks like

Most Postgres performance problems trace back to the same handful of causes. Fix those and the ceiling rises by orders of magnitude.

Partition the big tables

Very large tables belong in partitions that follow how the data is written and read. Each partition stays small enough for its indexes to fit in memory, maintenance runs on manageable pieces, and old data can be dropped cheaply.

Batch your writes

Inserting row by row spends most of its time on round trips. Sending rows in batches with prepared statements is often the biggest single gain a high-volume system can get.

Choose indexes on purpose

Every index speeds up some reads and slows down every write. Index what is really queried, and pick the index type that suits the data. A lightweight index on an ever-increasing timestamp costs almost nothing to maintain.

Delete old data gradually

Removing millions of rows in one statement bloats tables and holds up replication. Expire data in small batches or drop whole partitions, and let vacuum keep pace.

Page without OFFSET

Paging through large result sets by “the last key I saw” instead of an offset keeps the millionth page as quick as the first.

Tune it and watch it

Connection pooling, memory settings that match the machine, autovacuum tuned for write-heavy tables, and monitoring of the early warning signs: replication lag, table bloat, long-running queries and lock waits.

When another store really fits better

There are real limits. Cassandra deserves a look when:

  • write volume exceeds what one primary server can take, even after the steps above;
  • data is always read by key, never joined or queried ad hoc;
  • data is written once and simply expires;
  • writes have to be accepted in several data centres at the same time.

For the smallest, hottest lookups that happen on every request, an in-memory cache such as Redis goes in front. These are additions for particular jobs, not replacements. Design the system so a dataset could move to another store later if it must, and you will see that most of them never need to leave Postgres.

Before leaving Postgres, check

  • Are the large tables partitioned?
  • Are writes sent in batches?
  • Does every index pay for itself?
  • Is old data removed a little at a time?
  • Is the server tuned and monitored for this workload?

If any answer is no, the database you already run very likely has plenty of headroom left.

FAQ

How many inserts a day can PostgreSQL handle?

A properly configured PostgreSQL can take over 100 million inserts a day in production, with an even larger read load. The limit is usually the setup rather than the database: partitioning, batched writes and tuning raise the ceiling by orders of magnitude.

Is PostgreSQL really free for commercial use?

Yes. It is released under a permissive open-source licence with no licence fees or per-core pricing, and an independent community develops it rather than a single vendor.

When should I choose Cassandra over PostgreSQL?

When write volume exceeds a single primary even after tuning, data is always read by key and never queried ad hoc, data is written once and expires, or writes must be accepted in several data centres at once.

What usually makes PostgreSQL slow at high volume?

Row-by-row inserts, huge unpartitioned tables, too many indexes, mass deletes that bloat tables, and OFFSET pagination. Fixing these usually gains far more than switching databases.

How far have you taken PostgreSQL, and where did it finally hit a limit? We would like to hear about it.

Want a second pair of eyes on your platform?

Tell us what you run. You will get a straight answer from an engineer, not a sales pitch.