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?

Analysis: EVs are now nine times cheaper than petrol or diesel to drive in UK

https://www.carbonbrief.org/analysis-evs-are-now-nine-times-cheaper-than-petrol-or-diesel-to-driv...
1•xbmcuser•2m ago•0 comments

Rickrolling with a Pharmacy Cross

https://hugoarnal.com/blog/rickroll-pharmacy-cross/
1•dimonomid•5m ago•0 comments

Bitcoin-rs: an independent Bitcoin node written in Rust

https://github.com/gosuda/bitcoin-rs
1•gosunuts•7m ago•0 comments

Liquid Glass UI-Inspired Glass Effects Library

https://github.com/dashersw/liquid-glass-js
1•arbayi•8m ago•0 comments

SpaceX's Starship launching to orbit for first time ever today

https://www.space.com/space-exploration/launches-spacecraft/spacexs-starship-megarocket-launching...
1•geox•10m ago•0 comments

Reverse Engineering the iPod Classic's Undocumented Mikey Chip

https://terminalbytes.com/reverse-engineering-ipod-classic-mikey-chip/
1•birdculture•10m ago•0 comments

Three Days in August: What a DDoS Attack Exposed in Our Network

https://nine.ch/en/blog/ddos-attack-august-2026-postmortem/
1•nine_ch•12m ago•0 comments

Large Scale Threat Actor Attribution from Infostealer Logs

https://blog.glazer.ee/posts/large-scale-threat-actor-attribution-from-infostealer-logs/
2•hexdecoct•15m ago•0 comments

Google: AI-Assisted Rewrites of C/C++ Dependencies to Rust

https://bughunters.google.com/blog/scaling-memory-safety
2•fork-bomber•19m ago•0 comments

Personal Continuity Plans (Digital Legacy)

https://ripe92.ripe.net/programme/meeting-plan/sessions/103/7PEF7V/#robert-kisteleki
1•speckx•20m ago•0 comments

Big AI's content problem: Take the work, keep the money

https://www.theregister.com/columnists/2026/09/27/big-ais-content-problem-take-the-work-keep-the-...
1•samizdis•21m ago•0 comments

LLMs in Professional Software Engineering

https://knorpelsenf.me/posts/semantic-translation
2•avestura•21m ago•0 comments

Can Life Be Explained by Physics? (Featuring Prof. Brian Cox) [video]

https://www.youtube.com/watch?v=k-vm3ZWnMWk
2•binyu•24m ago•0 comments

ETH Computer Science enrolment saw a 15 percent decline

https://ethz.ch/en/news-and-events/eth-news/news/2026/09/viel-interesse-am-eth-studium.html
2•hubraumhugo•25m ago•0 comments

Unified U.S. Site Blocking Bill Targets ISPs and DNS Resolvers but Spares VPNs

https://torrentfreak.com/unified-u-s-site-blocking-bill-targets-isps-and-dns-resolvers-but-spares...
3•t-3•27m ago•0 comments

Show HN: Free alternative to graphics design giants

https://scissor.studio/
2•sia_xi•30m ago•0 comments

Are Big Tech bonds crowding out the US Treasury?

https://www.ft.com/content/6354c1ec-286a-4251-bac8-ca0cd4ac7eac
1•ksec•30m ago•1 comments

The Risks of Ignoring API Security During Mobile App Security Testing

1•kunal9955•31m ago•0 comments

How I Use "AI" (2024)

https://nicholas.carlini.com/writing/2024/how-i-use-ai.html
1•microsoftedging•31m ago•0 comments

Show HN: Redthread – autonomous LLM pentesting with proof-of-concept exploits

https://millenniums.ai/docs
2•bl014h•31m ago•0 comments

Pixi adds non-Python deps to Python notebooks

https://marimo.io/blog/pixi-sandboxes
1•cantdutchthis•32m ago•0 comments

Show HN: Impressive hand detection AI algorithm

https://github.com/aryafarkhondeh/cp_hand_demo
1•sia_xi•34m ago•1 comments

The Cybersecurity Siege Economy

https://dntls.substack.com/p/the-cybersecurity-siege-economy-part
1•StrontiumK9•40m ago•0 comments

European industry is doing better than you may think

https://www.economist.com/business/2026/09/27/european-industry-is-doing-better-than-you-may-think
2•doener•42m ago•0 comments

Doing math together in the age of AI

https://dustingmixon.wordpress.com/2026/09/27/doing-math-together-in-the-age-of-ai/
1•mathfan•43m ago•0 comments

Show HN: Caspian – Desktop app to build and launch small vibe-coded projects

https://caspian.md
1•sshussain270•44m ago•0 comments

What if AGI was invented in Ancient Greece?

https://www.echohive.ai/experiments/the-eighth-wonder
1•echohive42•48m ago•0 comments

AI companies in race to demonstrate their model most threatening to humanity

https://thecivilian.co.nz/2026/09/27/ai-companies-in-fierce-arms-race-to-demonstrate-their-model-...
4•ljewalsh•50m ago•0 comments

37,500 border drawings: a map of the world as people remember it

https://www.habibicode.org/thedrawnworld
3•nicocarsui•50m ago•3 comments

iOS 27's Reworked Stub Islands

https://codecolor.ist/posts/2026-06-15-ios27-reworked-stub-islands/
1•porridgeraisin•51m ago•0 comments