frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Ask HN: How can I load test PostgreSQL but avoid changing actual data?

1•LawZiL•1y ago
I'm running a load test on my Node.js application and want to simulate realistic write-heavy scenarios to stress test the system — especially the PostgreSQL database.

There's a part of the code that performs UPDATE queries, but during load testing, I don't want these updates to actually change the state of the database. However, I still want the database to experience the full impact of the update — query planning, locking, I/O, WAL writes, etc. — so I can measure how it affects performance under peak load.

Is there a best-practice approach to achieve this?

So far, the most viable option I’ve found is to wrap the UPDATE queries in a transaction and then roll it back — that way, the queries still execute, but the state doesn’t change. Is this the right way to go? Does rollback introduce any performance overhead that would skew my results? Are there better or more realistic alternatives that simulate the full write path without persisting changes?

Thanks in advance!

Comments

sargstuff•1y ago
pgbench[2] / pgreplay-go[0] / python locust[1]

very old school approach:

Misuse sql VIEW[3][4] to generate a temporary parallel table setup. Testing database separate from production database would be 'better', IMHO.

-----

[0] pgreplay-go : https://github.com/gocardless/pgreplay-go

[1] python locust : https://miguel-codes.medium.com/unconventional-load-testing-...

[2] pgbench load testing :

   a) https://medium.com/@c.ucanefe/pgbench-load-test-166bdfb5c75a

   b) https://neon.tech/blog/autoscaling-in-action-postgres-load-testing-with-pgbench

   c) https://hackernoon.com/how-to-create-and-load-test-data-in-postgresql-i41e353m
----------------------------

[3] : a) https://hashrocket.com/blog/posts/materialized-view-strategi...

      b) https://tech.jonathangardner.net/wiki/PostgreSQL/Materialized_Views

      c) https://stackoverflow.com/questions/77603705/what-is-the-use-of-materialized-view-in-postgresql
[4] : https://en.wikipedia.org/wiki/View_(SQL)
LawZiL•1y ago
but again, how can i perform the query, but not actually change the state, i really need the state to keep untouched, but be able to perform the query itself.
MatthiasPortzel•1y ago
> Does rollback introduce any performance overhead that would skew my results?

I would expect it to be the other way around—since the transactions are rolled back and not committed, they would have significantly less performance impact. But I’m working from an academic model of the database.

apothegm•1y ago
Load test against a clone instead of a DB whose contents you care about?

Show HN: Cfnrain, a community fork of AWS's archived CloudFormation CLI rain

https://github.com/awesome-foundation/cfnrain
1•allixsenos•42s ago•0 comments

Show HN: Offline PDF Desk – one HTML file, redacts and merges PDFs offline

https://dowla0.gumroad.com/l/offline-pdf-desk
1•Vladenik•1m ago•0 comments

Supply chain security for open source maintainers

https://safedep.io/oss/
2•tech_solver•1m ago•0 comments

Empires of AI

https://www.foreignaffairs.com/china/empires-artificial-intelligence-niall-ferguson-eric-schmidt
1•simonebrunozzi•1m ago•0 comments

Microsoft offers mass buyouts for roughly a quarter of its workforce

https://www.seattletimes.com/business/microsoft/microsoft-offers-mass-buyouts-for-roughly-a-quart...
2•doctorzook•2m ago•0 comments

Eric Bauza, Voice of Bugs Bunny and Daffy Duck, Dies at 46

https://www.washingtonpost.com/nation/2026/10/26/eric-bauza-voice-looney-tunes-characters-bugs-bu...
4•bookofjoe•4m ago•2 comments

Lead Harbour, find people asking to buy what your online store sells

https://leadharbour.tech/
1•raysyarov•4m ago•0 comments

Ask HN: What are your creative context bombs to make AI agents pay?

1•reacharavindh•5m ago•0 comments

Matthew Butterick makes an excellent point about textbook sizes [video]

https://www.youtube.com/watch?v=W-ryv6TwQvM
1•starmftronajoll•5m ago•0 comments

CEO

https://www.mobluehq.com/portfolio/bluemonster
1•adamfaust•6m ago•0 comments

That free beer has a brewer

https://bytecode.news/posts/2026/10/that-free-beer-has-a-brewer
1•Teckla•6m ago•0 comments

Chaos and bifurcations in continuous language-model feedback

https://arxiv.org/abs/2610.31692
1•tidojo•8m ago•0 comments

Code review was never about the code

https://mattstromawn.com/writing/code-review-was-never-about-the-code/
1•jackcarter•8m ago•0 comments

What if we had infinite intelligence over infinite goods and services data?

https://asymmetry.so/
1•gigaboy•8m ago•0 comments

Investigating changes in the writing style of HN users since the advent of LLMs

https://thinkwhere.wordpress.com/2026/10/26/investigating-if-the-writing-style-of-users-on-hacker...
1•chippy•8m ago•0 comments

Working with Clay, How Software Engineering Is Changing

https://brittany-ellich.offprint.app/a/3mypjxxufes23-working-with-clay
1•overcommitted•10m ago•0 comments

'It's offensively cheap': Solar power is quietly becoming bigger than nuclear

https://www.bbc.com/future/article/20261023-how-solar-became-bigger-than-nuclear
7•geox•11m ago•4 comments

Early DigitalOcean Was Scared of Its Hypervisors

https://aybabt.me/blog/early-digitalocean-was-scared-of-its-hypervisors/
1•AYBABTME•12m ago•0 comments

AI Is Turning Old Games Into Living Worlds [video]

https://www.youtube.com/watch?v=HqAQDGVoDbE
1•lroe•12m ago•0 comments

Examine the costs of turning America's corn into fuel

https://worldsensorium.com/hucked-and-shucked/
1•dnetesn•12m ago•0 comments

Room Design with AI – Free Room Designer – iRoomDesign

https://iroomdesign.com
1•jacksteven•12m ago•1 comments

We used AI to predict how much people will talk about AI

https://altertable.ai/blog/2026-10-26-forecasting-the-ai-hype
1•altertable•13m ago•1 comments

How the Mirror Fixes the Reflection

https://howthemirrorfixesus.com/
1•mkanephl•13m ago•0 comments

How Large Scale Protest Organizers Can Build Big Tech Surveillance Networks

https://sk500.online/politics/how-large-scale-protest-organizers-can-build-big-tech-surveillance-...
1•airhangerf15•13m ago•0 comments

The Responsibility of Invention

https://blue-continuum.com/the-responsibility-of-invention
1•dnetesn•13m ago•0 comments

Font Revival

https://font-revival.com/
1•wyclif•14m ago•0 comments

NBA announces partnership with prediction markets Kalshi, Polymarket

https://www.nytimes.com/athletic/7723134/2026/10/26/nba-kalshi-polymarket-agreement-prediction-ma...
2•cdrnsf•14m ago•0 comments

I Got 429 Problems, but a Cache Ain't One

https://blog.chocolatey.org/2026/07/ccr-rate-limiting-explained/
1•bariumbitmap•16m ago•0 comments

Show HN: Sturnus, a latency-based LLM load balancer

https://github.com/sturnus-dev/sturnus
1•dannyboland•17m ago•0 comments

Policy

https://www.anthropic.com/news/policy
2•surprisetalk•17m ago•0 comments