frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

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

1•LawZiL•12mo 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•12mo 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•12mo 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•12mo 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•12mo ago
Load test against a clone instead of a DB whose contents you care about?

Abstract Machines for Logic Programs

https://chrisistyping.bearblog.dev/abstract-machines-for-logic-programs/
1•surprisetalk•28s ago•0 comments

Rex is a secure script execution engine that uses Cedar policies

https://github.com/trusted-remote-execution/trusted-remote-execution
1•mooreds•1m ago•0 comments

Do houseplants improve air quality?

https://www.economist.com/science-and-technology/2026/05/08/do-houseplants-improve-air-quality
1•andsoitis•2m ago•0 comments

Analysis points to a unexpected cause of reading difficulties

https://phys.org/news/2026-05-years-struggles-obvious-massive-analysis.html
1•wglb•3m ago•1 comments

Grok 4.3

https://docs.x.ai/developers/models
1•webninja•5m ago•0 comments

AI creates a fearsome cold-war-style dilemma

https://www.economist.com/china/2026/05/07/ai-creates-a-fearsome-cold-war-style-dilemma
1•andsoitis•5m ago•0 comments

Visit a Mosque in video game format and learn things about Islam

https://islamicsystems.itch.io/the-mosque-visit
1•JSLegendDev•8m ago•0 comments

Build Your Own ALU

https://virissimo.info/build-your-own-alu/
1•virissimo•13m ago•1 comments

Why saying hello to strangers can be good for you

https://text.npr.org/g-s1-119761
1•1659447091•13m ago•0 comments

DeepInfra raises $107M Series B

https://deepinfra.com/blog/deepinfra-series-b
1•didon•14m ago•0 comments

Some gene therapies no longer require clinical trials, thanks to new FDA rule

https://www.livescience.com/health/some-gene-therapies-no-longer-require-clinical-trials-thanks-t...
2•geox•16m ago•0 comments

What Software Engineers Can Learn from the Aviation Industry

https://mwalterskirchen.dev/blog/piloting-agentic-engineering/
1•JSLegendDev•17m ago•0 comments

Chasing Chicago's movable bridges (2014)

https://aresluna.org/seesaws-for-giants/
1•NaOH•18m ago•0 comments

Windows 11 is getting faster the lazy way

https://www.neowin.net/opinions/windows-11-is-getting-faster-the-lazy-way/
1•bundie•19m ago•0 comments

A multiplayer poll where you have 10 seconds to answer

https://polls.araoz.net/poll/pilot
1•maraoz•26m ago•0 comments

Did the Soviets Collude in the 1953 Candidates Tournament?

https://lichess.org/@/RuyLopez1000/blog/did-the-soviets-collude-in-the-1953-candidates-tournament...
2•fzliu•34m ago•0 comments

Docker Containers Are Leaking (and How to Plug the Hole)

https://blog.dera.page/posts/dockerwall/
1•Mubelotix•35m ago•0 comments

Engineering Recovery

https://systemsthinkingcollection.substack.com/p/the-three-legged-stool
1•InputName•41m ago•0 comments

Mark Zuckerberg Told 8k Employees Their Layoffs Are a Line Item in AI Bill

https://247wallst.com/investing/2026/05/08/mark-zuckerberg-just-told-8000-employees-their-layoffs...
2•spankibalt•45m ago•2 comments

60fps Video on a CGA? – The GlyphBlaster

https://martypc.blogspot.com/2026/05/60fps-video-on-cga-glyphblaster.html
1•tambourine_man•48m ago•0 comments

Xi's Forever Purge

https://www.foreignaffairs.com/china/xis-forever-purge
2•areoform•48m ago•1 comments

Physics experiment hints at the existence of 'anyon' particles

https://www.sciencedaily.com/releases/2026/05/260508003131.htm
1•johndunne•53m ago•0 comments

Catatumbo Lightning

https://en.wikipedia.org/wiki/Catatumbo_lightning
1•nomilk•54m ago•0 comments

Deskbrid – Linux desktop control over a Unix socket, for agents and scripts

https://github.com/coe0718/deskbrid
3•coe0718•57m ago•0 comments

Kendrick Lamar to an Italian Poet

https://www.youtube.com/watch?v=q5dqCeNEIFU
2•lawgimenez•58m ago•0 comments

24/7 AI-powered radio station. Generates music, writes hosted breaks,speaks them

https://github.com/keltokhy/writ-fm
2•pseudolus•1h ago•0 comments

New York Stock Exchange to open private members' club on Wall Street

https://www.ft.com/content/d8e49edb-feb9-4bfb-9f91-f10169c0961d
1•petethomas•1h ago•0 comments

Abbey Library of Saint Gall

https://en.wikipedia.org/wiki/Abbey_library_of_Saint_Gall
3•peter_d_sherman•1h ago•0 comments

Maryland Power Bills: $1.6B Data Center Subsidy

https://unusualwhales.com/news/maryland-1-6-billion-data-center-power-bill-subsidy
3•gmays•1h ago•0 comments

I built a private memory system for remembering people

https://apps.apple.com/us/app/intriq-remember-people/id6760826319
3•Phangweijun•1h ago•0 comments