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?

EU officials peeved after Anthropic sends junior staffer to testify about safety

https://www.politico.eu/article/anthropic-european-parliament-donny-greenberg-artificial-intellig...
1•intunderflow•1m ago•0 comments

A Universe from Three Sectors: Recovering TradeWars 2002's Map from Its RNG Seed

https://mattmichie.com/2026/07/14/a-universe-from-three-sectors/
1•influx•6m ago•0 comments

Looking for a remote internship (Fall/Winter/Spring 2026)

1•cnnadozi•7m ago•1 comments

JOBCV.IO - Free Resume Maker Online – Build Your Professional CV

https://jobcv.io/en
1•grossos•7m ago•1 comments

Cross sectioning insects in an electron microscope with a femtosecond laser

https://www.youtube.com/watch?v=NwhVJ7cv9B4
1•fallinditch•8m ago•0 comments

Casberi: Apps in one feed, no account, everything on-device

https://casberi.app
1•alexchopan•9m ago•0 comments

Manage your Claude Code agents in Raycast

https://github.com/vmc-7645/claude-fleet
1•vmc_7645•10m ago•1 comments

Laptop touchpad stopped registering clicks? try this

2•LandOfMightDev•11m ago•0 comments

Deep dive: Quad storage for optimal throughput and latency

https://blog.canoozie.net/four-integers-and-a-lot-of-wrong-assumptions/
1•jtregunna•12m ago•1 comments

OpenAI Launches Hardware for Codex

https://www.theverge.com/ai-artificial-intelligence/965901/openai-hardware-codex-micro-launch
1•thunderbong•14m ago•0 comments

Consultant Bench

https://innolitics.com/articles/consultant-benchmark/
1•innolitics•15m ago•1 comments

The lost joy of music piracy

https://www.pigeonsandplanes.com/read/music-piracy-what-cd-oink-nine-inch-nails-streaming
3•mcgin•23m ago•0 comments

How TypeScript devs can avoid getting pwned by malicious packages

https://builtbystef.com/blog/supply-chain-security/
1•builtbystef•25m ago•0 comments

Reynard: A real Firefox web browser for iOS 13 or later

https://github.com/minh-ton/reynard-browser
1•AbuAssar•33m ago•0 comments

Stop saying that AI is just a tool and it only matters how it is used

https://www.frank.computer/blog/2025/05/just-a-tool.html
5•cratermoon•38m ago•4 comments

Business Finance Tips for Small Business Owners in the UAE and India

https://adilrashidlone.substack.com/p/business-finance-tips-for-small-business
2•digitaldaddyme•38m ago•0 comments

Panix – the oldest commercial Internet provider in New York

https://panix.com/
1•uproarchat•40m ago•0 comments

Show HN: Complete the survey and get personal free AI toothpaste recommendation

https://tpmme.me
1•notlibrary•41m ago•0 comments

Which founders created the most wealth for others?

https://wealth-creators-omega.vercel.app
2•probe•42m ago•0 comments

Don't Pee on My Leg and Call It Science

https://stager.tv/?p=4381
1•the-mitr•43m ago•0 comments

Show HN: AI Starter Templates in NextJS and OpenAI

https://suhasbhairav.com/ai-templates
1•bsuhas•45m ago•1 comments

WSJ: The AI Backlash Has Tech Executives Fearing for Their Lives

https://www.wsj.com/us-news/the-ai-backlash-has-tech-executives-fearing-for-their-lives-30c43972
10•testfoobar•51m ago•4 comments

AI Is Not a Tool

https://theconvivialsociety.substack.com/p/your-ai-is-not-a-tool
6•crowdhailer•52m ago•2 comments

How to make AI safe and free of America and China

https://www.economist.com/leaders/2026/07/15/how-to-make-ai-safe-and-free-of-america-and-china
3•andsoitis•1h ago•0 comments

Beware Change-Blocking Priors

https://www.overcomingbias.com/p/beware-change-blocking-priors
3•paulpauper•1h ago•0 comments

There is no AI in Team

https://arnoldkling.substack.com/p/there-is-no-ai-in-team
3•paulpauper•1h ago•0 comments

Show HN: A Lightweight, open-source always-on-top local AI desktop companion

https://github.com/Rupak182/heychat/releases/tag/v0.1.0
2•Rupak182•1h ago•0 comments

An Interactive Map of AI

https://artifipedia.com/map
16•ceprompts•1h ago•8 comments

Crystal ML Library: Autograd, Tensors, Neural Networks, Optimizers

https://github.com/skuznetsov/cogni-ml
3•zX41ZdbW•1h ago•0 comments

My Throw Decides My Aim

https://thegustafson.com/blog/my-throw-decides-my-aim
10•usernotfoundrn•1h ago•1 comments