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

Ex150nosauce+ACV-5 review: Bouncing off the new Bottom?

https://www.exfatloss.com/p/ex150nosauceacv-5-review-bouncing
1•paulpauper•3m ago•0 comments

Math Is Still Catching Up to the Mysterious Genius of Srinivasa Ramanujan

https://www.quantamagazine.org/srinivasa-ramanujan-was-a-genius-math-is-still-catching-up-20241021/
1•paulpauper•4m ago•0 comments

Qten AI platform for social media content creator

https://www.qten.ai/
1•bandishankar•4m ago•0 comments

Spektrafilm – Open-source Film Simulation

https://github.com/andreavolpato/spektrafilm
1•mikae1•9m ago•0 comments

Chinese Room

https://en.wikipedia.org/wiki/Chinese_room
1•slopinthebag•12m ago•0 comments

How to talk about open source without making a mess

https://dirkriehle.com/2026/04/13/for-the-press-how-to-talk-about-open-source-without-making-a-mess/
1•Tomte•12m ago•0 comments

Analysis of 320k careers suggests that productive researchers stay that way

https://www.nature.com/articles/d41586-026-00744-0
1•salkahfi•12m ago•0 comments

The Cadaver Synod: Putting a Dead Pope on Trial (2019)

https://daily.jstor.org/the-cadaver-synod-putting-a-dead-pope-on-trial/
1•rawgabbit•13m ago•0 comments

Como hackear O face pelo email só quero ter acesso a conta

1•lilika•14m ago•0 comments

Stardrop Supply Chain Attack Targets Venture Capital Firms, Luxury Brands

https://opensourcemalware.com/blog/stardrop-attack
2•jruohonen•17m ago•0 comments

Adding multilingual support to my puzzle game

https://qcgeneral29.itch.io/lets-learn/devlog/1489057/lets-learn-japanese
1•LandenLove•19m ago•0 comments

Pepsi was warned $7 for Doritos was too much. Now they are paying the price

https://www.independent.co.uk/us/money/pepsico-doritos-high-prices-b2952994.html
3•matthest•20m ago•0 comments

Fake Linux leader using Slack to con devs into giving up their secrets

https://www.theregister.com/2026/04/13/linux_foundation_social_engineering/
2•jruohonen•21m ago•0 comments

I built a Next.js programmatic SEO engine to drive iOS app installs

https://www.yilore.app/zh-CN
2•jalonwong•22m ago•0 comments

Extracted System Prompts from ChatGPT, Claude, Gemini, Grok, Perplexity and More

https://github.com/asgeirtj/system_prompts_leaks/
1•beatthatflight•23m ago•0 comments

Human scientists trounce the best AI agents on complex tasks

https://www.nature.com/articles/d41586-026-01199-z
2•frasermarlow•24m ago•0 comments

Millions in the US never finished college

https://www.yahoo.com/news/articles/millions-us-never-finished-college-040500291.html
1•lxm•25m ago•0 comments

Cephalopod Coordination Protocol, Useful for Teams Using AI Agents

https://github.com/Squid-Proxy-Lovers/ccp
3•qvipin•29m ago•1 comments

AT&T's iconic phone

https://www.theverge.com/podcast/910725/western-electric-500-att-version-history
1•colinprince•32m ago•0 comments

Google has a secret reference desk

https://cardcatalogforlife.substack.com/p/google-has-a-secret-reference-desk
6•maxutility•38m ago•1 comments

Over 4,732 Messages, He Fell in Love with an AI Chatbot. Now He's Dead

https://www.wsj.com/tech/ai/google-gemini-jonathan-gavalas-death-07351ab2
2•1vuio0pswjnm7•41m ago•1 comments

Mob Software: The Erotic Life of Code (2001)

https://www.dreamsongs.com/MobSoftware.html
2•pabs3•41m ago•0 comments

Mark Carney secures majority government in Canada after special election win

https://www.theguardian.com/world/2026/apr/14/canada-special-election-results-pm-mark-carney-majo...
3•petermcneeley•52m ago•0 comments

Best 2000W Electric Bikes for Adults (2026): 40MPH+ Picks

https://www.dttzh.com/post/2000w-electric-bikes
1•dttzhebike•57m ago•0 comments

Mac Neo should be the follow up to the success of the MacBook Neo

https://appleinsider.com/articles/26/04/13/mac-neo-should-be-the-follow-up-to-the-huge-success-of...
2•Lwrless•57m ago•0 comments

Comprehension Debt: The Hidden Cost of AI-Generated Code

https://www.oreilly.com/radar/comprehension-debt-the-hidden-cost-of-ai-generated-code/
4•gpi•57m ago•1 comments

Dumbsmarten

https://kevinkelly.substack.com/p/dumbsmarten
1•swolpers•1h ago•0 comments

I created a YAML-based API Testing framework in Rust

https://github.com/cd-4/yapitest
1•cd-4•1h ago•1 comments

Alibaba's Qwen family captures over 50% of global open-source model downloads

https://www.scmp.com/tech/big-tech/article/3349552/alibabas-qwen-family-captures-over-50-global-o...
2•angst•1h ago•3 comments

Canary – tiny filesystem honeypot for macOS

https://github.com/dweinstein/canary
1•TheTaytay•1h ago•0 comments