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

Can you get a star in Super Mario 64 using only one button? [video]

https://www.youtube.com/watch?v=-7VhlsqeeqI
1•unleaded•53s ago•0 comments

The Department of Defense Wants Less Proof Its Software Works

https://www.eff.org/deeplinks/2025/10/department-defense-wants-less-proof-its-software-works
1•hn_acker•3m ago•0 comments

The Situation: How Much Less Free Are We?

https://www.lawfaremedia.org/article/the-situation--how-much-less-free-are-we
1•hn_acker•4m ago•0 comments

Will Paramount Cancel Jon Stewart?

https://www.newyorker.com/culture/the-new-yorker-interview/will-paramount-cancel-jon-stewart
1•mitchbob•6m ago•1 comments

Interesting Research Programs from the 2010s (2020)

https://bcmullins.github.io/interesting-research-2010s/
1•vinhnx•6m ago•0 comments

TeraAgent: Simulating Half a Trillion Agents

https://arxiv.org/abs/2509.24063
1•jonbaer•7m ago•0 comments

Show HN: I've built a web based pdf/docx/pptx editor, the format .ldf

https://learny.academy/about
1•yeargun•11m ago•1 comments

Interactively explore FastAPI endpoints with FastAPI-Voyager

https://www.newsyeah.fun/voyager/
1•tank-34•16m ago•0 comments

Site and Formation Selection for CO2 Geological Sequestration

https://www.mdpi.com/2076-3417/15/21/11402
1•PaulHoule•17m ago•0 comments

Defeating the Training-Inference Mismatch via FP16

https://arxiv.org/abs/2510.26788
2•matt_d•19m ago•0 comments

The Psychology of Curiosity: A Review and Reinterpretation (1994) [pdf]

https://www.cmu.edu/dietrich/sds/docs/loewenstein/PsychofCuriosity.pdf
1•wslh•21m ago•0 comments

OpenAI updates terms to forbid usage for medical and legal advice

https://openai.com/policies/usage-policies/
3•piskov•22m ago•2 comments

Show HN: Strange Attractors

https://blog.shashanktomar.com/posts/strange-attractors
32•shashanktomar•24m ago•1 comments

Fix Your FODs

https://garnix.io/blog/fix-your-fods
1•birdculture•26m ago•0 comments

Introduction to Parallelism in PyTorch

https://ggrigorev.me/posts/introduction-to-parallelism/
2•vinhnx•28m ago•0 comments

Web of Science company involved in dubious awards in Iraq

https://retractionwatch.com/2025/10/31/exclusive-clarivate-web-of-science-involved-dubious-awards...
2•leephillips•30m ago•0 comments

Why tequila depends on Mexico's bats

https://www.bbc.com/future/article/20251028-mexicos-tequila-future-depends-on-bats
3•1659447091•33m ago•0 comments

Big Tech's market dominance is becoming ever more extreme

https://www.ft.com/content/ae4d7961-cf59-4369-8e64-8a9c9da956d1
4•zerosizedweasle•34m ago•0 comments

Fed 'Chorus' Comes Out Against Latest Cut, Citing Inflation

https://www.bloomberg.com/news/articles/2025-10-31/fed-s-logan-says-didn-t-want-rate-cut-with-inf...
5•zerosizedweasle•34m ago•0 comments

Show HN: Durbat – Write Rust Code Using Black Speech

https://github.com/itsfoxstudio/durbat
1•rpunkfu•35m ago•0 comments

Al Qaeda Is on the Brink of Taking over a Country

https://www.wsj.com/world/africa/al-qaeda-is-on-the-brink-of-taking-over-a-country-ffd35ea4
4•wslh•35m ago•1 comments

Show HN: Modern PHP development with Vite, it's ecosystem and PHP components

https://github.com/nititech/modern-php-vite-starter
2•donnikitos•38m ago•0 comments

The Geometry of Schemes [pdf]

https://webhomes.maths.ed.ac.uk/~v1ranick/papers/eisenbudharris.pdf
2•measurablefunc•41m ago•0 comments

Photographing the rare brown hyena stalking a diamond mining ghost town

https://www.bbc.com/future/article/20251014-the-rare-hyena-stalking-a-diamond-mining-ghost-town
4•1659447091•44m ago•0 comments

S.a.r.c.a.s.m: Slightly Annoying Rubik's Cube Automatic Solving Machine

https://github.com/vindar/SARCASM
3•chris_overseas•44m ago•0 comments

Best Practices for Registration Forms

https://fusionauth.io/articles/identity-basics/registration-best-practices
1•mooreds•47m ago•0 comments

Hobbies Through Acquisition

https://nodumbideas.com/p/the-big-idea-hobbies-through-acquisition
1•mooreds•47m ago•0 comments

Self-hostable open source MS Word editor with real-time collaboration

https://www.superdoc.dev
2•fittingopposite•49m ago•0 comments

Behind y-s2: serverless multiplayer rooms

https://s2.dev/blog/durable-yjs-rooms
1•infiniteregrets•58m ago•0 comments

Auditing Permissions for All Shared Files in Google Drive

https://blog.terrydjony.com/google-drive-audit-access-permissions/
1•terryds•58m ago•0 comments