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?

AI tools I use (avg software developer)

https://fredrikmeyer.net/2026/11/07/how-i-use-ai-2026.html
1•FredrikMeyer•31s ago•1 comments

1325 Dutch hotels join mass claim lawsuit against Booking.com

https://nltimes.nl/2026/11/07/1325-dutch-hotels-join-mass-claim-lawsuit-bookingcom
1•Betelbuddy•42s ago•0 comments

Report alleges China linked to at least 18 overseas police stations in Canada

https://www.ctvnews.ca/canada/article/report-alleges-china-linked-to-at-least-18-overseas-police-...
2•Teever•1m ago•0 comments

China drafts lifetime ID codes for every robot it makes, not just humanoids

https://asia-tech-news.ghost.io/china-drafts-lifetime-id-codes-for-every-robot-it-makes-not-just-...
2•ilamont•2m ago•0 comments

Show HN: A framework for prototyping web games in 2D and 3D

https://github.com/kadhirvelm/resync-games-framework
1•kadhirvelm•2m ago•1 comments

You are protesting the wrong technology, people

https://hollisrobbinsanecdotal.substack.com/p/you-are-protesting-the-wrong-technology
1•HR01•3m ago•0 comments

Show HN: UK: Skip Royal Mail QR Code Queues with the Prince of Post

https://princeofpost.com
1•egamirorrim•4m ago•0 comments

Structify: AI apps built on a manufacturer's ERP data

https://www.structify.ai
1•alexreichenbach•5m ago•0 comments

Show HN: Bodylang – ask anything about your body and watch it happen in 3D

https://bodylang.vercel.app/
1•mantegna•6m ago•0 comments

Show HN: Digdeep.fyi – A DNS Debug Tool for DNSSEC, Mail, HTTP

https://digdeep.fyi/
1•oipart•8m ago•0 comments

The ESP32 S31 Runs Linux

https://www.i-programmer.info/news/91-hardware/19197-the-esp32-s31-runs-linux.html
2•teleforce•10m ago•0 comments

Straitjacket: A TypeScript template with Guardrails for your agents

https://github.com/balajeerc/straitjacket
1•hannofcart•14m ago•0 comments

Dave Winer's prototype for the web of Markdown

https://demo.bonbonweb.org/?url=https%3A%2F%2Fdave.writersweb.org%2Fscripting%2F2026%2F11%2F06.md
1•solomania9•14m ago•0 comments

FM-1: Things Are Happening with This Little Synth [video]

https://www.youtube.com/watch?v=hmYPh5CYtWw
1•alin23•15m ago•0 comments

Isn't It Time for AVIF Everywhere?

https://www.michaelponders.com/2026/11/isnt-it-time-for-avif-everywhere.html
3•speckx•20m ago•0 comments

Show HN: I mapped all known crypto scams

https://dontgetrekt.today/
1•marciob•20m ago•2 comments

Choosing One of My Compiler Books [pdf]

https://t3x.org/files/whichbook.pdf
1•AlexeyBrin•22m ago•0 comments

Five Memorable Books About Programming

https://prog21.dadgum.com/19.html
2•andsoitis•23m ago•0 comments

NASA's Juno Captured a Green Lightning Flash Inside a Storm on Jupiter

https://www.space.com/jupiter-lightning-north-pole-juno-photo
1•Adam-Hincu•23m ago•0 comments

Show HN: Coldframe, a honeypot that poses as a supermarket fridge controller

https://github.com/hedgerow-dev/coldframe
15•hedgerow-dev•26m ago•1 comments

Things That Turbo Pascal Is Smaller Than (2011)

https://prog21.dadgum.com/116.html
1•theanonymousone•27m ago•0 comments

Ripple – The CI gate that knows the blast radius

https://www.npmjs.com/package/@alimaandev/ripple
1•alimaandev111•28m ago•0 comments

Nice DeepSWE score! Does it survive a lowercase filename?

https://twitter.com/loresjpg/status/2118880329490637049
1•porridgeraisin•34m ago•0 comments

Hacking the meta ray-ban smartglasses

https://p0pcycle.com/2026/11/06/hacking-the-meta-ray-ban-smartglasses/
1•moooooky•35m ago•0 comments

MaxxBench – "Nice DeepSWE score. But is it true?"

https://maxxbench.unlap.ai/research/why-maxxbench/
2•antiuniverse•35m ago•0 comments

Windows Sandbox

https://learn.microsoft.com/en-us/windows/security/application-security/application-isolation/win...
1•azhenley•35m ago•0 comments

Show HN: LaunchZone Submissions – we submit your product to directories by hand

https://submit.launchzone.co
1•launchzone_co•38m ago•0 comments

How to Start a Startup Game

https://www.neuroplusgbrain.net/
1•FDX2018•42m ago•0 comments

Why the Fascination with Retrocomputing?

https://kevinboone.me/retrocomputing.html
2•andsoitis•42m ago•1 comments

GTA2 RTX Remix – HD Cars Edition

https://github.com/kirmm3la/gta2-rtx-remix-upgraded
1•doener•43m ago•0 comments