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?

1•temp_debugger•5s ago

My suitcase robot gets high off a real gas sensor wired into the LLM sampler

https://old.reddit.com/r/LocalLLaMA/comments/1u9a17y/my_suitcase_robot_gets_high_now_off_a_real_gas/
1•thunderbong•3m ago•0 comments

Project Valhalla, Explained: How a Decade of Work Arrives in JDK 28

https://www.jvm-weekly.com/p/project-valhalla-explained-how-a
1•philonoist•7m ago•0 comments

Computer Chronicles

https://archive.org/details/computerchronicles
1•modinfo•7m ago•0 comments

Understanding Geometric Algebra for Electromagnetic Theory

https://ieeexplore.ieee.org/document/6474507
1•teleforce•9m ago•0 comments

Future of Software Engineering (2003)

https://web.archive.org/web/20151020012340/http://discuss.fogcreek.com/joelonsoftware1/default.as...
1•tosh•11m ago•0 comments

The Lonely Work of Moderating Hacker News (2019)

https://www.newyorker.com/news/letter-from-silicon-valley/the-lonely-work-of-moderating-hacker-news
2•andsoitis•12m ago•0 comments

GLM 5.2 vs. Opus

https://techstackups.com/comparisons/glm-5.2-vs-opus/
2•sixhobbits•16m ago•1 comments

Climate change: the CO2 emitter you may not know about (2018)

https://www.bbc.com/news/science-environment-46455844
3•downbad_•21m ago•0 comments

Mark Warren's favorite novels about a child's immersion into wilderness

https://bookdna.com/best-books/childs-immersion-into-wilderness
1•bwb•25m ago•0 comments

My favorite classic working-class novels of all time

https://bookdna.com/best-books/classic-working-class-novels-of-all-time
1•bwb•26m ago•1 comments

Iran Delays U.S. Peace Talks over Israeli Attacks in Lebanon

https://maritime-executive.com/article/report-iran-suspends-hormuz-talks-because-of-israeli-attac...
2•consumer451•28m ago•0 comments

Bobby Prince Jr (composer of classic Doom soundtrack) has passed away

https://www.legacy.com/legacy/robert-bobby-prince-lll
3•andystanton•35m ago•1 comments

So You Want to Define a Well-Known URI

https://mnot.net/blog/2026/well_known_uris
5•ingve•38m ago•0 comments

World Cup AI: which AI model is winning the World Cup?

https://worldcupai.org/
1•ValentineC•39m ago•1 comments

Ongoing: Cloudflare customers seeing incorrect invoice payments for 2.5 days

https://www.cloudflarestatus.com/incidents/nq5q2glxd4yw
1•imcotton•39m ago•0 comments

The ISA Doesn't Matter Where It Counts

https://www.chipstrat.com/p/the-isa-doesnt-matter-where-it-counts
2•ksec•40m ago•0 comments

Ask HN: Is anyone else leaving AUR?

1•lordkrandel•43m ago•1 comments

Apple A12 and A13 Chips: New Unpatchable Exploit

https://www.macrumors.com/2026/06/18/a12-and-a13-chips-facing-exploit/
5•tosh•44m ago•0 comments

DNI does press release on Covid-19 origins and coverup

https://www.odni.gov/index.php/newsroom/press-releases/press-releases-2026/4166-pr-11-26
1•anonymousiam•45m ago•2 comments

I reinvented website FAQ sections

https://answerpane.com/
2•MikeCatt•47m ago•0 comments

The comfortable slow boil of LLM assisted coding

https://01max.io/blog/a-comfortable-slow-boil/
2•maxime_•51m ago•0 comments

Renting vs. Buying – A case study for Bangalore

https://bangalore-property-buy-vs-rent.pagey.site/
4•freakynit•51m ago•0 comments

Show HN: `pbi`, an image aware pbcopy/paste for macOS command line users.

https://github.com/fragmede/pbi
1•fragmede•54m ago•0 comments

Maven Central introduces publishing limits

https://community.sonatype.com/t/maven-central-publishing-limits-what-high-volume-publishers-need...
1•justinblat•55m ago•0 comments

Looking to connect by helping founders find their first users

1•BonanKou•57m ago•0 comments

Someone at NPM needs see this – to stop the madness

https://www.youtube.com/watch?v=QIr58qqRyH8
1•ascended•58m ago•0 comments

Show HN: Protect your Go, Arch and AUR from Malware with a free firewall

https://www.vulnetix.com/features/package-firewall
1•ascended•1h ago•1 comments

I asked an online tracking company for my data and here's what I found (2018)

https://privacyinternational.org/long-read/2433/i-asked-online-tracking-company-all-my-data-and-h...
1•downbad_•1h ago•0 comments

Generative AI Is Having Its Herbalife Moment

https://www.whatwelo.st/p/generative-ai-is-having-its-herbalife
4•watermelon0•1h ago•0 comments