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

SEO Score for Your Docs

https://docsalot.dev/tools/docs-seo
1•fazkan•16s ago•0 comments

Interactive guide to Bitcoin's proof of work

https://bennet.org/learn/proof-of-work-what-bitcoin-mining-really-does/
1•tombennet•38s ago•0 comments

Show HN: TagLib-WASM – Read/write audio metadata with all JavaScript runtimes

1•CharlesW•1m ago•0 comments

Talk to Proteins

https://www.codyliu.com/chatmol
1•codyyyyliu•1m ago•0 comments

Opus 4.6, Codex 5.3, and the post-benchmark era

https://www.interconnects.ai/p/opus-46-vs-codex-53
1•gmays•2m ago•0 comments

Andreessen Horowitz's Rising Influence over Trump-Era AI Policy

https://www.bloomberg.com/news/features/2026-02-10/trump-s-ai-policy-shaped-by-vc-tech-giant-andr...
1•atlasunshrugged•2m ago•0 comments

Challenger Center announces Space Coding Challenges with Hack Club

https://challenger.org/news-insights/new-partnership-with-hack-club-launches-space-coding-challen...
1•Charmunk•3m ago•0 comments

The hunt for zero-CVE container images

https://thenewstack.io/chainguard-and-the-hunt-for-truly-zero-cve-container-images/
2•CrankyBear•4m ago•0 comments

Old Reddit Broken

https://old.reddit.com/r/help/comments/1r1fde4/is_old_reddit_super_super_broken_right_now_for/
1•amai•4m ago•0 comments

Turning YouTube into Cloud Storage [video]

https://www.youtube.com/watch?v=l03Os5uwWmk
1•f311a•5m ago•0 comments

Gallup will no longer measure presidential approval after 88 years

https://thehill.com/homenews/media/5733236-gallup-stops-presidential-approval-ratings-polls/
7•hypeatei•6m ago•1 comments

Show HN: Simulate Anybody's Gmail Inbox

https://unread.ooo/
1•theroo•6m ago•0 comments

Show HN: Steam and Autism, a book by Opus 4.6

https://github.com/cloudstreet-dev/STEAM-and-Autism
1•DavidCanHelp•7m ago•0 comments

Are we losing our sense of "Quality" in the age of AI agents

https://mcradcliffe.substack.com/p/zen-and-the-art-of-hand-written-code
1•bigpapikite•7m ago•0 comments

Metasurfaces create super-sized neutral atom arrays for quantum computing

https://physicsworld.com/a/metasurfaces-create-super-sized-neutral-atom-arrays-for-quantum-comput...
2•rbanffy•8m ago•0 comments

Google sent personal and financial information of student journalist to ICE

https://techcrunch.com/2026/02/10/google-sent-personal-and-financial-information-of-student-journ...
1•MaysonL•8m ago•0 comments

Building High-Performance Electron Apps

https://www.johnnyle.io/read/electron-performance
2•aCodeCrafter•9m ago•0 comments

What Is a Diminished Value Claim? The Secret to Recovering Your Car's Lost Value

https://suretyinsights.com/blog/what-is-a-diminished-value-claim-and-when-should-you-file-one
2•engelo_b•10m ago•0 comments

Can my SPARC server host a website?

https://rup12.net/posts/can-my-sparc-server-host-my-website/
3•abnercoimbre•11m ago•0 comments

The Incoming Slopocalypse and the Death(?) Of Open Source

https://www.llamaindex.ai/blog/on-the-incoming-slopocalypse-and-the-death-of-open-source
1•makaimc•13m ago•0 comments

A practical guide to use AI Coding agents

https://www.devtoolsacademy.com/blog/ai-coding-agents-practical-guide/
2•alokDT•13m ago•0 comments

Subreply – a text-only social network

https://subreply.com/trending
3•lucianmarin•13m ago•1 comments

DeepWiki and Increasing Malleability of Software

https://twitter.com/karpathy/status/2021633574089416993
1•tosh•15m ago•0 comments

Show HN: Claude helped me make a game to save a bike lane

https://bikemedford.org/bike-medford-game
2•logie17•17m ago•0 comments

Epstein Files Explorer – vibe coded dashboard app

https://epstein-file-explorer.replit.app/
2•felineflock•17m ago•0 comments

More Terrible Slack Setups

2•zeitgeistcowboy•19m ago•0 comments

St Helena loses commercial flights after safety downgrade

https://www.ch-aviation.com/news/163720-st-helena-loses-commercial-flights-after-safety-downgrade
1•beeforpork•19m ago•0 comments

Real-Time AI Built Directly in the T-Mobile Network

https://finance.yahoo.com/news/america-best-network-unleashes-another-123200491.html
1•ulrischa•20m ago•0 comments

Should your developer company go open source?

https://extremefoundership.substack.com/p/should-your-developer-company-go
2•paraphrenia•22m ago•0 comments

Awesome Vibe Coding – 245 AI coding tools and resources

https://github.com/taskade/awesome-vibe-coding
1•johnxie•22m ago•0 comments