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?

Ask HN: How many people got VPNs in response to laws like UK Online Safety Act?

1•hodgesrm•2m ago•0 comments

Show HN: Crovia Spider v1 –Forensic crawler exposing compliance gaps in LAION-5B

https://github.com/croviatrust/crovia-core-engine
1•crovia•4m ago•0 comments

Shoppers loved the 'fabric queen'. Then, order by order, her story fell apart

https://www.bbc.com/news/articles/c5y937w7xl7o
4•haunter•15m ago•0 comments

Distributed ID Formats Are Architectural Commitments, Not Just Data Types

https://piljoong.dev/posts/distributed-id-generation-complicated/
1•mnahkies•18m ago•0 comments

ESC

https://twitter.com/miniarchillect/status/1996986617710760054
1•keepamovin•19m ago•0 comments

Inercia 2025

https://2025.inercia.pt/en/
1•zansara•20m ago•0 comments

National Security Strategy of the United States of America [pdf]

https://www.whitehouse.gov/wp-content/uploads/2025/12/2025-National-Security-Strategy.pdf
1•keepamovin•26m ago•0 comments

Build your own compressed-sensing 1-pixel camera

https://www.instructables.com/Single-Pixel-Camera-Using-an-LED-Matrix/
1•gsf_emergency_6•27m ago•0 comments

Ahnlich, a fast lightweight similarity search engine

https://ahnlich.dev/
1•ddeven96•28m ago•2 comments

Single-pixel camera at home [video]

https://www.youtube.com/watch?v=EE9AETSoPHw
1•gsf_emergency_6•28m ago•0 comments

Ask HN: Is self-aware AI harmful for our culture?

1•eimrine•31m ago•0 comments

Ask HN: AMA – AI Startups Assessor and Strategy Consultant

1•duverse•40m ago•0 comments

Jujutsu v0.36.0 Released

https://github.com/jj-vcs/jj/releases/tag/v0.36.0
1•birdculture•41m ago•0 comments

AI detection tools cannot prove that text is AI-generated

https://www.seangoedecke.com/ai-detection/
3•Twixes•45m ago•0 comments

Show HN: Know your employees skills gap and boost retention rate

https://semis.reispar.com
1•tolulade_•45m ago•0 comments

The Gamma Language

https://lair.masot.net/gamma/
1•RossBencina•49m ago•0 comments

Giant humanoid electrical pylons

https://choishine.com/Giants.html
2•yzydserd•54m ago•0 comments

Should CSS Be Constraints?

https://pavpanchekha.com/blog/why-css-bad.html
2•tannhaeuser•58m ago•1 comments

Why Does A.I. Write Like That?

https://www.nytimes.com/2025/12/03/magazine/chatbot-writing-style.html
3•carabiner•59m ago•1 comments

Instagram Profit Margin Calculator Online Free Tool

https://metaconvert.blogspot.com/2025/10/instagram-profit-margin-calculator.html
2•MetaConvert•1h ago•0 comments

Unix Original Bell Labs v4 Found at University of Utah

https://www.youtube.com/watch?v=IR-f07LN0-Y
1•rasengan0•1h ago•0 comments

Grok 4.20 beats all other AI models in Alpha Arena test

https://www.sammyfans.com/2025/12/05/grok-4-20-beats-all-other-ai-models-in-alpha-arena-test/
2•terryds•1h ago•1 comments

High-Performance DBMSs with io_uring: When and How to use it

https://arxiv.org/abs/2512.04859
1•mfiguiere•1h ago•0 comments

Loopi – Open-Source Visual Browser Automation Platform

https://loopi.dyan.live/
1•0018akhil•1h ago•1 comments

Nano Banana Pro: reasoning-first 4K studio

https://nanobanapro.com
1•AnyVideoAI•1h ago•0 comments

Which protocol do you guys use in NAS shares to Proxmox – NFS or SMB?

https://old.reddit.com/r/Proxmox/comments/1i50jy9/which_protocol_do_you_guys_use_in_nas_shares_to/
2•sipofwater•1h ago•2 comments

Alternate Reality Christmas Gifts

https://medium.com/luminasticity/alternate-reality-christmas-gifts-9d9dd9c81a2b
1•bryanrasmussen•1h ago•0 comments

Show HN: How to play imposter game with impostergame.win

https://impostergame.win/how-to-play
1•tomstig•1h ago•1 comments

Turning everyday observations into investable signals

https://www.prophit.investments/
2•porterh•1h ago•1 comments

UK IVF couples rank embryos based on potential IQ, height and health

https://www.theguardian.com/society/2025/dec/06/uk-ivf-couples-use-legal-loophole-rank-embryos-iq...
2•sorokod•1h ago•0 comments