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?

Lyndon B. Johnson (1908 – 1973)

https://grokipedia.com/page/Lyndon_B._Johnson
1•__patchbit__•2m ago•0 comments

Mother sues OpenAI, alleging ChatGPT encouraged daughter's suicide

https://www.reuters.com/legal/litigation/mother-sues-openai-alleging-chatgpt-encouraged-daughters...
1•tartoran•3m ago•0 comments

Greg KH: Untrusted data in Linux – How Rust is going to save us [video]

https://www.youtube.com/watch?v=Nzmj7K0FNRY
1•NobodyNada•3m ago•0 comments

I robotics company Theker raises $85M from investors including LVMH

https://www.reuters.com/business/ai-robotics-company-theker-raises-85-million-investors-including...
1•tartoran•4m ago•0 comments

Show HN: Open-source API Key server written in Go by Ory

https://github.com/ory/talos/tree/master
1•leetvibecoder•4m ago•0 comments

Who Is Responsible for Answers AI Gives You? A German Court Has Some Thoughts

https://read.misalignedmag.com/who-is-responsible-for-answers-ai-gives-you-a-german-court-has-som...
1•lcubw•4m ago•0 comments

Mt-32pi Developer Withdraws

https://github.com/dwhinham/mt32-pi/commit/075b52809e77420c6e80828825fe42430336b369
1•anotherhue•5m ago•0 comments

Everyone wants to be a DJ, no one wants to dance (2025)

https://danioffline.substack.com/p/everyone-wants-to-be-a-dj-no-one
1•sebg•5m ago•0 comments

Profiling in PyTorch (Part 2): From Nn.Linear to a Fused MLP

https://huggingface.co/blog/torch-mlp-fusion
1•Brajeshwar•7m ago•0 comments

Kotinos: Ergo Fingertip Shell Mod for HSK Pro

https://github.com/pseudoku/Kotinos
1•bpierre•7m ago•0 comments

(Re//Verse 2026) Taxonomy and Deobfuscation of a Real World Binary Obfuscator [pdf]

https://github.com/AnalogCyberNuke/RE-Verse-2026-Slides/blob/main/Reverse26.pdf
2•not_a9•7m ago•1 comments

Hey Siri, Call Google

https://demaree.me/p/hey-siri-call-google/
1•demaree•8m ago•0 comments

Can 1000 people have a meaningful conversation? AI may make it possible

https://bigthink.com/science-tech/collective-superintelligence/
1•hogwash•8m ago•0 comments

ITScape: Guest-to-Host Escape in KVM/ARM64

https://github.com/V4bel/ITScape
1•_callumguy•8m ago•0 comments

Agentic-Engineering-Handbook

https://github.com/keyuchen21/agentic-engineering-handbook
1•keyuchen2020•9m ago•0 comments

Stdx: Rust's Extended Standard Library

https://github.com/rust-stdx/stdx
2•randomint64•11m ago•0 comments

A Beginner's Guide to Mischief

https://rawandferal.substack.com/p/a-beginners-guide-to-mischief
1•sebg•12m ago•0 comments

The fork costs nothing now

https://www.lopez.fi/blog/the-fork-costs-nothing-now
1•dockerd•12m ago•0 comments

Craig Federighi Details Apple's Collaboration with Google for Siri AI in iOS 27

https://9to5mac.com/2026/06/08/craig-federighi-details-apples-collaboration-with-google-for-siri-...
2•tambourine_man•12m ago•0 comments

The Compliance.tf Registry Is Now Public

https://compliance.tf/blog/compliance-tf-registry-is-now-public/
1•mooreds•12m ago•0 comments

Dean Rusk (1909 – 1994)

https://grokipedia.com/page/Dean_Rusk
1•__patchbit__•13m ago•0 comments

Go Supply Guard

https://github.com/Kernalytics/go-supply-guard
1•wieweit•13m ago•0 comments

Amazon Says Its Data Centers Use 2.5B Gallons of Water

https://www.bloomberg.com/news/articles/2026-06-11/amazon-says-its-data-centers-use-2-5-billion-g...
14•1vuio0pswjnm7•15m ago•5 comments

AI Billboards, Two Truths and a Lie

https://wallpaper.audiodude.xyz
3•audiodude•16m ago•2 comments

Agent Harness Should Repair Itself

https://twitter.com/akshay_pachaar/status/2064051835636498924
2•gmays•16m ago•0 comments

Crusoe Pushed Aside at Wyoming AI Project After Google Concerns

https://www.bloomberg.com/news/articles/2026-06-11/crusoe-pushed-aside-at-wyoming-ai-project-afte...
2•1vuio0pswjnm7•16m ago•0 comments

Driving in America Is Headlight Hell

https://www.theatlantic.com/technology/2026/06/car-headlights-too-bright-adaptive-beams/687488/
7•pavel_lishin•18m ago•1 comments

How to Stop a Killer Asteroid

https://nautil.us/how-to-stop-a-killer-asteroid-1281888
2•Brajeshwar•19m ago•0 comments

Situational Awareness: The Decade Ahead

https://situational-awareness.ai/
3•yusufozkan•19m ago•0 comments

We Are On A Runaway Freight Train

https://mdelcaro.substack.com/p/the-freight-train
2•fathermarz•21m ago•0 comments