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

Show HN: Guide – A Cognitive Behavioural Therapy Inspired To-Do App

https://blog.nextfive.in/demo/guide/
1•4mitkumar•2m ago•0 comments

Listen to music like it's 2005

https://lukecyca.com/2025/listen-to-music-like-its-2005.html
1•10729287•3m ago•0 comments

Programmable Diffractive Deep Neural Networks

https://www.nature.com/articles/s41598-025-19638-8
1•tesserato•6m ago•0 comments

He managed to format a 3.5" disk so that it could contain more data than 1.44MB

https://old.reddit.com/r/AskReddit/comments/1pea1t8/comment/nsdzhkz/
1•danso•7m ago•0 comments

Mahjong

https://en.wikipedia.org/wiki/Mahjong
1•tosh•8m ago•0 comments

Netflix says it's struck a deal to buy Warner Bros. Discovery

https://www.cnbc.com/2025/12/05/neflix-warner-bros-discovery-deal.html
2•vo2maxer•9m ago•0 comments

Netflix to Acquire Warner Bros. In an $82.7B Deal

https://about.netflix.com/en/news/netflix-to-acquire-warner-bros
69•meetpateltech•14m ago•23 comments

Elon Musk's X fined €120M by EU in first clash under new digital laws

https://www.theguardian.com/technology/2025/dec/05/elon-musk-x-fined-eu-first-clash-under-new-dig...
2•robin_reala•15m ago•0 comments

Volcanic eruption led to the Black Death, new research suggests

https://www.cnn.com/2025/12/04/science/black-death-volcanic-eruption-tree-rings
3•giuliomagnifico•16m ago•0 comments

How Russia keeps raising an army to replace its dead

https://www.politico.com/news/2025/12/05/russia-planned-war-of-attrition-00672960
2•gregorymichael•17m ago•0 comments

Downdetector and the real cost of no upstream dependencies

https://blog.pragmaticengineer.com/downdetector-and-the-real-cost-of-no-upstream-dependencies/
1•robin_reala•18m ago•0 comments

How should we peer review software?

https://mirawelner.com/posts/peer_review.html
1•birdculture•19m ago•0 comments

Sugars, Gum, Stardust Found in NASA's Asteroid Bennu Samples

https://www.nasa.gov/missions/osiris-rex/sugars-gum-stardust-found-in-nasas-asteroid-bennu-samples/
5•jnord•23m ago•0 comments

Get access to clients Meta and Google accounts

https://clientinvite.com
1•lingohr•23m ago•1 comments

Turned a simple idea with friends into an actual app

1•paoloauletta•24m ago•0 comments

React2Shell Exploit Analysis with POCs (RCE in Next.js)

https://github.com/freeqaz/react2shell
1•freeqaz•26m ago•1 comments

Microsoft steers native port of TypeScript to early 2026 release

https://www.infoworld.com/article/4100582/microsoft-steers-native-port-of-typescript-to-early-202...
1•maxloh•27m ago•0 comments

Show HN: Daily Logic Grid Puzzles

https://www.puzzleship.com/logic/logic-puzzles
1•slig•27m ago•0 comments

Commission fines X €120M under the Digital Services Act

https://ec.europa.eu/commission/presscorner/detail/en/ip_25_2934
2•nabla9•28m ago•1 comments

Show HN: Potato – AI meeting assistant that does useful stuff

https://meetpotato.com/
1•rsdza•28m ago•1 comments

ARM's Barrel Shifting Tricks

https://xania.org/202512/05-barrel-shifting-with-arm
2•hasheddan•28m ago•0 comments

Anthropic's Development Practices: A Customer's Technical Analysis

1•AnonHere•32m ago•0 comments

Zelensky's Government Sabotaged Oversight, Allowing Corruption to Fester

https://www.nytimes.com/2025/12/05/world/europe/ukraine-corruption-zelensky.html
1•koolba•33m ago•3 comments

Island: Linux sandboxing tool powered by Landlock

https://github.com/landlock-lsm/island
2•l0kod•34m ago•1 comments

Anthropic Interviewer

https://www.anthropic.com/research/anthropic-interviewer
1•ta_u•34m ago•0 comments

2025 USA National Security Strategy [pdf]

https://www.whitehouse.gov/wp-content/uploads/2025/12/2025-National-Security-Strategy.pdf
2•Epa095•36m ago•1 comments

Cary-Hiroyuki Tagawa, 75, passed away

https://apnews.com/article/cary-hiroyuki-tagawa-died-2a5ac471aa2dd5d7218205ff8b654b08
2•nobodyandproud•39m ago•1 comments

Why I Hate Frameworks

https://minds.md/benji/frameworks
2•samixg•41m ago•0 comments

Most prediction market users aren't trading–they're gambling

1•Miramaps•47m ago•2 comments

How I use Git worktrees

https://matklad.github.io/2024/07/25/git-worktrees.html
1•lemonwaterlime•47m ago•0 comments