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

A Python framework for building reliable software

https://zenodo.org/records/18016750
1•dohuyhoangvn93•42s ago•0 comments

Speed limits introduced on UK motorways (1956)

https://www.bbc.co.uk/news/videos/c62vvvk7zlxo
1•jjgreen•6m ago•0 comments

Backing Up Spotify

https://annas-archive.org/blog/backing-up-spotify.html
3•taubek•7m ago•0 comments

How to Use AI to Automate Repetitive Tasks Across Multiple Fields

https://sites.google.com/view/getafilenowcpa/accueil
1•SSStentacion•10m ago•0 comments

From Runtime Explosions to Compiler Checked Simplicity

https://paul-samuels.com/blog/2025/12/21/from-runtime-explosions-to-compiler-checked-simplicity/
1•ingve•11m ago•0 comments

I built two dozen single-file HTML tools that run offline and need no back end

3•ajtracysk•12m ago•0 comments

Show HN: Everything Is Free – An open source, CC0 electronic album

https://github.com/ichbinsoftware/everythingisfree
1•ichbinsoftware•13m ago•1 comments

A Cypherpunk's Manifesto

https://www.activism.net/cypherpunk/manifesto.html
2•avonmach•18m ago•0 comments

Can James Cameron make another blockbuster? Even he's not sure

https://www.cnn.com/2025/12/19/entertainment/video/james-cameron-avatar
1•benkan•20m ago•0 comments

CS Books I'll be reading in 2026

https://sushantdhiman.substack.com/p/cs-books-ill-be-reading-in-2026
1•x-sushant-x•21m ago•0 comments

Italian Competition Authority Fines Apple $115M for Abusing Dominant Position

https://en.agcm.it/en/media/press-releases/2025/12/A561
3•amarcheschi•28m ago•0 comments

Tachyon: High frequency statistical sampling profiler

https://docs.python.org/3.15/library/profiling.sampling.html
1•vismit2000•29m ago•0 comments

The Humanoid Redundancy Principle

1•aniijbod•29m ago•0 comments

Getting Started with Zebra AI – Zebra AI

https://zebra-ai.com/knowledge-base/getting-started-with-zebra-ai/
1•janandonly•33m ago•0 comments

The Mozilla I want focuses on people and not AI

https://andregarzia.com/2025/04/the-mozilla-i-want-focus-on-people-and-not-ai.html
2•Vinnl•33m ago•0 comments

University threatened with legal action after protest at academic's talk (UK)

https://www.bbc.co.uk/news/articles/cwyx3y84ln9o
1•mmarian•36m ago•0 comments

Nuno Loureiro, prof and dir of MITs Plasma Science and Fusion Center, dies at 47

https://news.mit.edu/2025/nuno-loureiro-professor-director-plasma-science-and-fusion-center-dies-...
2•gjvc•37m ago•0 comments

The Eye keeps your data simple clean and secure

https://eyebase.vercel.app/home
1•kira_aziz•37m ago•0 comments

Key Transparency for the Fediverse

https://soatok.blog/2025/12/15/announcing-key-transparency-fediverse/
2•walterbell•38m ago•0 comments

I love Kubernetes, I'm all-in on GitOps – but I hated diffs (until HelmEnvDelta)

https://medium.com/@balazs.csaba.diy/i-love-kubernetes-im-all-in-on-gitops-but-i-hated-env-to-env...
1•csababalazs•43m ago•0 comments

I Spent 3 Months Researching Image-Based Attacks

https://zero-trust-web.vercel.app/
3•Raviteja_•44m ago•1 comments

Japan to support domestic AI development with $6.34B

https://english.kyodonews.net/articles/-/67255
2•giuliomagnifico•48m ago•0 comments

Em Dash in Reddit Comments, Interactive

https://intervolz.com/emdash-observer/
2•jonatron•48m ago•7 comments

Chinese Chipmakers Race to IPOs

https://www.businesstimes.com.sg/international/global/chinese-chipmakers-race-ipo-after-back-back...
1•antman•49m ago•0 comments

Europe gets serious about cutting digital umbilical chord with US big tech

https://www.theregister.com/2025/12/22/europe_gets_serious_about_cutting/
10•jjgreen•49m ago•4 comments

Switchberry – CM4 Managed Switch for PTP, GPS, NTP, and PPS

https://github.com/geerlingguy/raspberry-pi-pcie-devices/issues/715
2•RossBencina•51m ago•1 comments

A comprehensive and precise spec (2016)

https://www.commitstrip.com/en/2016/08/25/a-very-comprehensive-and-precise-spec/
1•tannhaeuser•51m ago•0 comments

Germany Shifts to Nuclear Fusion After Fukushima-Era Fission Policy

https://www.forbes.com/sites/kensilverstein/2025/12/08/germany-shifts-to-nuclear-fusion-after-fuk...
3•mpweiher•53m ago•0 comments

Tasker: Multi-Agent Development with Claude Code

https://gonzo.engineer/posts/introducing-tasker/
1•Dowwie•53m ago•0 comments

How Do You Make Money in AI?

https://chiefting.substack.com/p/how-do-you-make-money-in-ai
1•mpraz•55m ago•0 comments