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?

Discord Alternaive

https://zrzur.com/
1•Opero•29s ago•0 comments

AI is to academic research what the tractor was to farming

https://lemire.me/blog/2026/12/05/smaller-teams-will-win/
1•chmaynard•29s ago•0 comments

AWS MadPot findings: Exposed AI systems are a top target for attackers

https://www.aboutamazon.com/news/aws/aws-madpot-ai-threat-intelligence
1•gmays•3m ago•0 comments

Holistics Security Incident

https://status.holistics.io/cmxarbzq1004r1mnrmjfemtlb
1•napsterbr•5m ago•0 comments

Nvidia delays quarterly report, says PwC audit no longer reliable

https://www.afr.com/world/north-america/nvidia-delays-quarterly-report-says-pwc-audit-no-longer-r...
4•onemoresoop•7m ago•0 comments

Show HN: A lightweight, no-fuss Hacker News client for your terminal

https://github.com/jsattler/hn
1•jsattler•10m ago•0 comments

A Z-Machine Interpreter for Geos

https://www.amigalove.com/viewtopic.php?t=3088
1•erickhill•15m ago•0 comments

Flint: Faster Rust Builds than cargo with LLVM free back end

https://github.com/Ataraxy-Labs/flint
1•wild-king•20m ago•0 comments

America is snatching many of Europe's best founders

https://www.economist.com/business/2026/11/29/america-is-snatching-many-of-europes-best-founders
2•Anon84•21m ago•3 comments

AI-related job cuts resurge in November

https://www.cfodive.com/news/ai-related-job-cuts-resurge-november-layoffs/876337/
1•frank_clover•25m ago•2 comments

Yggthreads: A tree of names as the database, and an app as a text file of forms

https://peterretief.org/posts/names-as-the-database/
2•peter_retief•27m ago•0 comments

ROS2 X OpenTelemetry: End-to-End Telemetry for Robotics

https://github.com/szobov/ros-opentelemetry
1•sounds-like-lx•28m ago•0 comments

Yubikey-Guide – protect secrets with hardware crypto

https://github.com/drduh/YubiKey-Guide
1•jdnier•28m ago•0 comments

China is defying the laws of economics to manufacture ever more

https://www.economist.com/interactive/briefing/2026/12/03/china-is-defying-the-laws-of-economics-...
5•marojejian•29m ago•1 comments

With a Counterexample, Mathematicians Show That It's an Unfair World

https://www.quantamagazine.org/with-a-counterexample-mathematicians-show-that-its-an-unfair-world...
2•pseudolus•30m ago•0 comments

A Post Quantum Cryptographic Overlay Network

https://github.com/Xaoc-Industries/Xaoc-CrosLink-R1
1•WJAppleton•30m ago•0 comments

Lokey: A firmware framework for input devices

https://lokey.rs/blog/introducing-lokey
1•n1ks•31m ago•0 comments

I saved 100 product launch videos and am curating the best here

https://www.launchreels.xyz
1•sabziwalla•31m ago•1 comments

X Allows Interactive Embeds

https://twitter.com/RohitPaulK/status/2129265280966881623
2•rohitpaulk•31m ago•0 comments

Iran restricts bank withdrawals at 8 crypto exchanges as rial weakens vs. dollar

https://www.coindesk.com/business/2026/12/05/iran-restricts-bank-withdrawals-at-8-crypto-exchange...
1•greenchair•31m ago•0 comments

I Was the Target of a State-Sponsored Hacking Attempt

https://thewalrus.ca/i-was-the-target-of-a-state-sponsored-hacking-attempt/
1•pseudolus•32m ago•0 comments

TheNativeMenace or how we hacked 1Password, Bitwarden and Claude Desktop

https://hades.cs.uic.edu/blog/native_menace/
1•uuju•33m ago•0 comments

Collection of AI-checked math and CS formalizations in Lean 4

https://github.com/google-deepmind/formal-papers
1•gmays•33m ago•0 comments

Show HN: Ibex a C++ engine for Polars and standalone DSL

https://ibexlang.org/polars.html
3•Bootvis•34m ago•0 comments

OpenIDEA – The IDE you know, rebuilt in Rust

https://openidea.sh/en
1•sagacity•36m ago•0 comments

Show HN: 3,700 AI UGC reactions for TikTok and Instagram to promote your app

https://www.ugcreactionvideos.com/
5•azeemkafridi•37m ago•0 comments

Show HN: Tether Relay – connection tunneling from your hotspot-connected laptop

https://github.com/nikhilshinday/tether-relay
1•chaos_emergent•38m ago•0 comments

How EFF and Certbot Are Working to Protect Websites

https://www.eff.org/deeplinks/2026/12/how-eff-and-certbot-are-working-protect-websites
2•hn_acker•38m ago•0 comments

Show HN: I built Yapped, a WhatsApp Wrapped that runs in the browser

https://yapped.devwithcoffee.com/
1•himanshuSri24•42m ago•0 comments

Californians have the legal right to bypass customer service chatbots

https://pluralistic.net/2026/12/05/thank-you-come-again/
1•hn_acker•43m ago•0 comments