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•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?

Baylibre Partners with SpacemiT to Bring Android 16 to RISC-V

https://baylibre.com/blog/baylibre-partners-with-spacemit-to-bring-android-16-to-risc-v/
1•fork-bomber•29s ago•0 comments

Learning-focused CTFs are Facing a Restructure

https://exploiting.systems/posts/2026-05-17-learning-focused-ctfs-are-facing-a-restructure
1•ropbear•1m ago•0 comments

HearHam Live Repeater listing app

https://hearham.com/repeaters
1•fodmap•2m ago•0 comments

The new class of AI jobs

https://www.businessinsider.com/new-ai-jobs-2026-5
3•giuliomagnifico•4m ago•0 comments

Qubes OS: A reasonably secure operating system

https://www.qubes-os.org/
1•throwoutway•7m ago•0 comments

Utah lawmakers form united front in push to ban prediction markets

https://www.theguardian.com/us-news/2026/may/18/you-can-bet-on-it-utah-lawmakers-form-united-fron...
1•thm•7m ago•0 comments

Busting performance issues, AI edition

https://p403n1x87.github.io/busting-performance-issues-ai-edition.html
1•p403n1x87•9m ago•0 comments

What A.I. Did to My College Class

https://www.nytimes.com/2026/05/17/opinion/chatgpt-ai-college-school-graduation.html
1•thm•10m ago•0 comments

How to Write Something Wise (Maria Popova Interview) [video]

https://www.youtube.com/watch?v=yb9Tz-RQFN4
1•freediver•11m ago•0 comments

I automated opt-outs for 500 data broker sites (open source)

https://github.com/stephenlthorn/auto-identity-remove
2•stephenlthorn•13m ago•0 comments

AI agent harnesses like OpenClaw are changing LLMs, inference, and CPUs

https://www.theregister.com/ai-ml/2026/05/17/how-ai-agent-harnesses-like-openclaw-are-changing-ll...
1•abdelhousni•16m ago•0 comments

The Global Fertility Crisis Is Worse Than You Probably Think

https://www.derekthompson.org/p/why-the-whole-world-stopped-having
5•momentmaker•20m ago•0 comments

How Trump's crypto venture and Iran's top exchange tapped into the same networks

https://www.reuters.com/investigations/how-trumps-crypto-venture-irans-top-exchange-tapped-into-s...
2•notagoodidea•22m ago•1 comments

Show HN: Chrome extension that hides YouTube shorts and other distractions

https://chromewebstore.google.com/detail/distraction-free-youtube/ckkcdcieljicflmkokdekbfpkclmmibp
2•mikax•22m ago•1 comments

Now that code is cheap, personal and open software is next

https://blog.stromflix.com/personal-software-is-next
1•StromFLIX•24m ago•0 comments

How to Create Your Own Bespoke, Artisanal, Hand-Drawn PCBs

https://www.hackster.io/news/how-to-create-your-own-bespoke-artisanal-hand-drawn-pcbs-d96d6978a4fb
2•CTOSian•27m ago•0 comments

Japanese-style free pdf editor

https://katanapdf.com/
1•samuraiduckling•28m ago•1 comments

The Backward Logic of Chickenpox Parties

https://www.wired.com/story/chickenpox-parties-and-the-pre-vaccine-internet/
1•joozio•29m ago•0 comments

Indexing code by behavior not imports – tested on large repos, seeking feedback

1•afxuh•29m ago•0 comments

Ask HN: Which books do you wish you'd read earlier in life?

1•jimsojim•32m ago•0 comments

I made a machine that burns money to prove it doesnt exists [video]

https://www.youtube.com/watch?v=2UM4j1_xEs0
3•tzvc•33m ago•1 comments

Spec-Driven Development with math-glyph compression

https://github.com/kborovik/pilot-skills/
1•kborovik•34m ago•0 comments

Zero a Language for Humans and Robots

https://zero-lang.com/
1•dcu•34m ago•0 comments

Show HN: Alder: Dynamic Code Execution Without Roslyn

1•MartiSilvio•36m ago•0 comments

A Danish Couple's Maverick African Research Finds Its Moment in RFK Jr.'S Vacci

https://www.wired.com/story/a-danish-couples-maverick-african-research-finds-its-moment-in-rfk-jr...
2•joozio•37m ago•0 comments

Tim – A High-Performance Template Engine and Markup Language

https://github.com/openpeeps/tim
1•TheWiggles•38m ago•0 comments

Show HN: I built an easy to manage, sharable personal memory for my AI agents

https://ai.actingweb.io/
1•gregertw•43m ago•1 comments

Show HN: Shiftpaper – native parallax wallpaper engine for Wayland

https://github.com/CPritch/shiftpaper
3•PxldLtd•43m ago•0 comments

An ICE Firearms Trainer Was Involved in at Least 4 Deadly Shootings

https://www.wired.com/story/an-ice-firearms-trainer-was-involved-in-at-least-4-deadly-shootings/
4•joozio•44m ago•0 comments

Am I part of the luckiest generation in history?

https://www.bbc.co.uk/news/articles/cj6pyk7e3w4o
2•mmarian•45m ago•0 comments