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?

Your Child's privacy is worth more than likes (2022)

https://www.luizasnewsletter.com/p/your-childs-privacy-is-worth-more
1•downbad_•47s ago•0 comments

Open-source, agent-friendly accounting platform

https://github.com/getmithril/ledger
1•maxmartinezruts•1m ago•0 comments

Energy – Work at the Speed of Thought

https://getenergy.com/
1•ohong•2m ago•0 comments

Stop Feeding the Machine: Time to Go Closed Source

https://medium.com/@post.pc.developer/stop-feeding-the-machine-time-to-go-closed-source-e08b8824d007
1•emdashslop•3m ago•0 comments

Cashing in on SpaceX: 'Every chance I get, I'll sell a little more'

https://www.bbc.com/news/articles/cm2g0j3y339o
3•jethronethro•4m ago•0 comments

Lumetry, a RAW photo editor that never uploads your photos

https://lumetry.photo
1•bhaviktdaya•4m ago•0 comments

Transparent AI Labeling

https://beaucronin.com/tail/
1•beaucronin•5m ago•1 comments

Gemini Robotics Released One Policy from Feet to Fingertips

https://topicqueue.substack.com/p/gemini-robotics-released-one-policy
1•DISCURSIVE•5m ago•0 comments

Putin signs landmark crypto law allowing regulated retail trading in Russia

https://www.theblock.co/post/410951/putin-signs-russia-crypto-law?
2•wslh•8m ago•0 comments

Because the machine must break (true empowerment in the age of AI tools)

https://www.nathalielawhead.com/candybox/because-the-machine-must-break-true-empowerment-in-the-a...
1•speckx•10m ago•0 comments

Ask HN: Is there any Hacker News but for investing/trading/economics etc.?

2•fittingopposite•11m ago•1 comments

State-Oriented Consistency: Why We Stopped Looking for One Right Answer

https://keel-iot.eu/blog/state-oriented-consistency.html
2•fcravio•11m ago•0 comments

Doortrackr

https://doortrackr.com
1•samtato•13m ago•0 comments

Why police raided Starbucks Korea's headquarters

https://www.cnn.com/2026/08/05/asia/south-korea-raid-starbucks-tank-ad-intl-hnk
2•firefax•13m ago•0 comments

Onida – Leading Home Appliance Brand in India

https://onida.com/
1•gurjeet•15m ago•0 comments

The Wind at Your Back

https://yusufaytas.com/the-wind-at-your-back
7•yusufaytas•16m ago•0 comments

Unconscious Inference

https://en.wikipedia.org/wiki/Unconscious_inference
2•binyu•16m ago•0 comments

Ask GitHub SRE: How serious is the situation there?

1•laxk•18m ago•0 comments

Depot CI Compatibility with GitHub Actions

https://depot.dev/docs/ci/compatibility
2•da768•19m ago•0 comments

Google is talking about Gemini 4 while 3.5 Pro remains delayed

https://www.reuters.com/business/google-shakes-up-ai-leadership-deepmind-chief-shifts-role-2026-0...
2•BlueBerry2001•20m ago•0 comments

Agent Plugins Specification

https://github.com/agentplugins/agent-plugins-spec
3•Kydlaw•20m ago•1 comments

The Printer

https://alnwlsn.com/z/printer/index.html
1•Cider9986•20m ago•0 comments

LettuceDetect v2 in Semantic Router: Gen. Hallucination Detection vLLM Endpoint

https://vllm-sr.ai/blog/lettucedetect-v2-generative-hallucination-detection/
1•matt_d•20m ago•0 comments

Reducing AppSec false positives with paraconsistent logic instead of thresholds

https://github.com/castrogusttavo/lpa2v-appsec
1•castrogusttavo•21m ago•0 comments

AI can now design functional viruses – not the computer kind, either

https://www.theregister.com/offbeat/2025/09/18/ai-can-now-design-more-deadly-virus-genomes/1489318
2•joebuckwilliams•21m ago•2 comments

Continual Learning via Real-Time RL for Agents

https://rllm-project.com/post.html?post=realtime_rl.md
1•matt_d•22m ago•0 comments

Cynicism and Naïveté in the Summer of a Thousand Fires

https://www.meditationsinanemergency.com/cynicism-and-naivete-in-the-summer-of-a-thousand-fires/
1•cdrnsf•22m ago•0 comments

The DISTINCT in Your COUNT

https://boringsql.com/posts/distinct-in-your-count/
9•gmcabrita•25m ago•0 comments

Large genome models used to design new viruses

https://arstechnica.com/science/2026/08/large-genome-models-used-to-design-new-viruses/
1•pera•26m ago•0 comments

xAI Ignores Laws and Profits: Rules for Thee, Not for Me

https://illegal.solutions/posts/xai_pollution
55•speckx•27m ago•17 comments