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?

A fast and secure tar parser for the Rust ecosystem

https://astral.sh/blog/tar-codec
1•woodruffw•17s ago•0 comments

Clone any website you want

https://getclonecode.com
1•thedbeaver•2m ago•0 comments

Discord to allow messages to appear in search engines

https://support.discord.com/hc/en-us/articles/44049845164823-Discoverable-Server-Web-Presence
2•tech234a•3m ago•1 comments

My LLM confirmed a booking that was never saved

https://usewello.com.br
1•original-frog•3m ago•0 comments

Show HN: I built a Lovable Alternative that runs in the browser

https://playplanet.dev/
1•bobsingor•4m ago•0 comments

Resilience4cata – retries and circuit breakers written at compile time

https://github.com/fabiangftech/resilience4cata
1•fguaman•4m ago•0 comments

Who needs AI psychosis? I gave myself VR psychosis

https://blog.jacobstechtavern.com/p/vr-psychosis
3•jakey_bakey•5m ago•0 comments

Owning the Harder Problems

https://agesback.substack.com/p/owning-the-harder-problems
1•wawhal•5m ago•0 comments

Show HN: Advaita Vedanta – Offline Books for Android

https://play.google.com/store/apps/details?id=com.vedantalibrary.vedanta_library&hl=en_US
1•bhattattreya•6m ago•0 comments

At 14 Justine Tunney published software. Now she makes AI models run from a file

https://timesofindia.indiatimes.com/education/news/at-14-justine-tunney-was-already-publishing-so...
1•hochmartinez•6m ago•0 comments

I Believe P=NP

https://emanueleviola.wordpress.com/2018/02/16/i-believe-pnp/
2•paulpauper•7m ago•0 comments

How the Nobel Became the Nobel

https://distressedscientists.substack.com/p/why-do-we-care-about-the-nobel-prize
1•paulpauper•7m ago•0 comments

Which musical styles do smart people prefer?

https://twitter.com/calotonterias/status/2114750328067293454
1•paulpauper•8m ago•0 comments

AI co-authored commits: 3 open-source projects in 2023, 686 of 874 in 2026

https://borehole.dev/data/ai-policies
1•nerolabs•8m ago•1 comments

Chinese scientists create powerful catalyst to turn air on Mars into rocket fuel

https://www.scmp.com/news/china/science/article/3372123/chinese-scientists-create-powerful-cataly...
1•bushwart•8m ago•0 comments

IP Camera Streaming: How to Set Up RTSP to WebRTC Streaming

https://www.red5.net/blog/ip-camera-live-streaming-rtsp-to-webrtc/
1•mondainx•9m ago•0 comments

Police Are Using AI to Pull over Drivers for 'Suspicious' Behavior

https://gizmodo.com/police-are-using-ai-to-pull-over-drivers-for-suspicious-behavior-2000831220
4•gumby•11m ago•1 comments

Heatbit's $899 Water Heater Element Mines Bitcoin While It Heats Your Tank

https://decrypt.co/381665/heatbits-899-water-heater-element-mines-bitcoin-while-it-heats-your-tank
2•bookofjoe•11m ago•0 comments

Running the Factorio PC Exe on an Xbox Series S

https://github.com/jdial1/factorio-xbox
2•albinoghost•11m ago•0 comments

Aristotle: Formal Verification for C and Verilog

https://www.harmonic.fun/news/aristotle-software-hardware-verification/
3•jasondavies•11m ago•0 comments

Show HN: Instance – A clean-room reimplementation of GameMaker 8.1 in Rust

https://github.com/groverburger/instance
1•__grob•12m ago•0 comments

A 28-Year-Old DOGE Operative Gutted USAID. HR Had No Record of Him Working There

https://www.wired.com/story/a-28-year-old-doge-operative-gutted-usaid-hr-had-no-record-of-him-wor...
6•ck2•13m ago•0 comments

Show HN: Duotone icon library with 2.5k+ icons and 250 flags, RTL aware

https://github.com/andrsrxn/icons
2•andrsrxn•14m ago•0 comments

Oracle unveils its first in-house Image/Video Models

https://blogs.oracle.com/ai-and-datascience/oracle-ai-media-models
3•goldemerald•15m ago•0 comments

Show HN: Python Implementation of Publication Open the Universes Theorem

https://github.com/GregorioOrtizPerez/The-Universes-Theorem---A-Unified-Architecture
1•GOP777•15m ago•0 comments

Large-scale single crystals printed layer by layer

https://www.nature.com/articles/d41586-026-03257-y
2•hunglee2•16m ago•0 comments

CreatedThreeWeeksAgo – new Wikipedia articles after the initial discussions

https://bitsanddopamine.github.io/CreatedThreeWeeksAgo/
2•ranulo•18m ago•1 comments

Slow Cloudflare Connections

2•bryonyoni•19m ago•0 comments

Come Back to Firefox. Meta Never Left

https://blog.ppb1701.com/come-back-to-firefox-meta-never-left
3•lylo•19m ago•0 comments

DeepMind unveils Genie 4 world model promising more realistic physics and humans

https://arstechnica.com/google/2026/10/deepminds-genie-4-world-model-adds-audio-and-more-realisti...
4•paaloeye•20m ago•1 comments