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•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?

Meloni's push to revive nuclear power runs into Italy's old ghosts

https://www.politico.eu/article/giorgia-meloni-nuclear-power-italy/
1•leonidasrup•2m ago•0 comments

Forward Deployed Engineering 101

https://twitter.com/vasuman/status/2057177266984226892
1•taubek•5m ago•0 comments

Meta Lays Off 8k Employees, as A.I. Casualties Mount

https://www.nytimes.com/2026/05/19/technology/meta-layoffs-ai.html
1•saikatsg•5m ago•0 comments

No JavaScript. No npms. Make realtime web apps in modern Java

https://github.com/vadimv/server-components
1•v4d1mv•6m ago•0 comments

Ad Infinitum

https://matthiasott.com/notes/ad-infinitum
1•robin_reala•7m ago•0 comments

Google Health 5.0 rolling out with new stats widget on Android

https://9to5google.com/2026/05/20/google-health-5-0-widget/
1•theanonymousone•8m ago•0 comments

Harvard faculty votes to make it more difficult for undergrads to earn A's

https://www.cnn.com/2026/05/20/us/harvard-undergrad-grades-faculty-vote
1•Tomte•9m ago•0 comments

Cows can recognize familiar human faces and match them to voices

https://phys.org/news/2026-05-cows-familiar-human-voices.html
1•giuliomagnifico•11m ago•0 comments

Walter Benjamin's Would-Be Rescuers

https://www.lrb.co.uk/blog/2026/may/walter-benjamin-s-would-be-rescuers
1•mitchbob•11m ago•0 comments

Iran is consolidating control of Hormuz with checkpoints, deals, and 'fees'

https://www.reuters.com/investigations/iran-is-consolidating-control-hormuz-with-island-checkpoin...
1•petethomas•12m ago•0 comments

Obsidian plugins are (mostly) dangerous

https://zeroquarry.com/research/excalidraw-vulnerabilities/
3•eskibars•13m ago•1 comments

Standard Charter CEO Replaces 8000 "Lower Value Humans" with AI

https://www.channelnewsasia.com/business/standard-chartered-reduce-7000-roles-2030-6129761
3•gmerc•21m ago•1 comments

The Case for Compilers: A Look at SPEC CPU 2026 on LLVM 22

https://www.servethehome.com/the-case-for-compilers-a-look-at-spec-cpu-2026-on-llvm-22/
2•csmantle•24m ago•0 comments

Tokenspeed – How fast is 10 tokens per second really?

https://mikeveerman.github.io/tokenspeed/?rate=30&mode=code
2•javatuts•25m ago•1 comments

Rule of Thirds

https://en.wikipedia.org/wiki/Rule_of_thirds
1•nomilk•27m ago•0 comments

NPM invalidates use of fine-grained tokens that bypass 2FA

https://docs.npmjs.com/trusted-publishers/
1•meander_water•33m ago•0 comments

How to Kill a Blog

https://robertbirming.com/how-kill-blog/
2•James72689•38m ago•0 comments

Your Read Model Doesn't Always Need a Database

https://docs.eventsourcingdb.io/blog/2026/05/21/your-read-model-doesnt-always-need-a-database/
1•goloroden•42m ago•0 comments

Show HN: ISSforAPUSH is conducting an "aggregated interview"

https://issforapush.netlify.app
1•audreyfei•49m ago•0 comments

Show HN: QuiteGPT – makes GPT response shorter

https://quiet-gpt.craftgarden.io/
1•leapoahead1•50m ago•0 comments

I made an AI Interior consultant

https://studio.mystofa.com/en-US
2•assorium•52m ago•0 comments

Bitcoin's Power Law: Weak Structure, Strong Forecasts

https://arxiv.org/abs/2605.21316
2•CarlosBaquero•53m ago•0 comments

Consciousness, Gödel, and the Boundary of the Box

https://twitter.com/VFD_org/status/2057053649315013042
2•__patchbit__•54m ago•0 comments

YAML? That's Norway Problem

https://lab174.com/blog/202601-yaml-norway/
2•theanonymousone•1h ago•1 comments

New on Platform

2•rockstaradi•1h ago•0 comments

Ye Olde RFC

https://github.com/gabinante/ye-olde-rfc
2•oooyay•1h ago•0 comments

Nostr-VPN Is one of the most useful things in open source

https://git.iris.to/#/npub1xdhnr9mrv47kkrn95k6cwecearydeh8e895990n3acntwvmgk2dsdeeycm/nostr-vpn
2•abhsag24•1h ago•0 comments

70% of Faculty Vote to Overhaul Harvard Grading with a Cap

https://www.thecrimson.com/article/2026/5/20/fas-passes-a-grade-cap/
1•k2enemy•1h ago•0 comments

List of Alleged Extraterrestrial Beings

https://en.wikipedia.org/wiki/List_of_alleged_extraterrestrial_beings
3•thunderbong•1h ago•0 comments

Software engineering is the tipping point [video]

https://www.youtube.com/watch?v=9t9Kj2f6wtU
1•azhenley•1h ago•0 comments