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?

Grilli Type

https://www.grillitype.com/
1•eustoria•1m ago•0 comments

Generative UI from Gemini 3 Pro

https://www.uxtigers.com/post/generative-ui-google
1•eustoria•2m ago•0 comments

What can I do with ReScript?

https://rescript-lang.org/blog/what-can-i-do-with-rescript/
1•ocamoss•3m ago•0 comments

Runaway Tokens (A Postmortem)

https://giantrat.bearblog.dev/runaway-tokens-postmortem/
1•bananatron•4m ago•0 comments

Audio Frequency-Time Dual Domain Evaluation on Depression Diagnosis

https://arxiv.org/abs/2510.22225
1•internetguy•4m ago•0 comments

Ford Considers Scrapping Electric Version of F-150 Truck

https://www.wsj.com/business/autos/ford-150-lightning-ev-decision-89dc0d84
1•devy•6m ago•1 comments

A Better Judging Algorithm for the Largest Hackathon in Wisconsin

https://ben.enterprises/hackathon-judging
5•DrawTR•6m ago•0 comments

The Stalled Charge:What Cutting EV Funding Means for the US Infrastructure Map

https://ozeanmedia.com/research/the-stalled-charge-what-cutting-ev-funding-means-for-americas-inf...
1•alexpatton•7m ago•1 comments

Show HN: Blog post runs P2P from my laptop

https://p2p.radio/X1D808/blog/2025-12-15_arriving-to-the-airport.html
1•nunobrito•9m ago•0 comments

LG TV users baffled by unremovable Microsoft Copilot installation

https://www.tomshardware.com/service-providers/tv-providers/lg-tv-update-adds-non-removable-micro...
2•jnord•9m ago•1 comments

Dawn: A distraction-free CLI writing env with live Markdown rendering

https://github.com/andrewmd5/dawn
1•gniting•9m ago•0 comments

PSA's parent company Collectors acquired Beckett to consolidate hobby market

https://www.collectors.com/company-announcement
1•donsupreme•12m ago•0 comments

Security at Blacksmith

https://www.blacksmith.sh/security
1•handfuloflight•12m ago•0 comments

Researchers reveal bias in a widely used measure of algorithm performance

https://www.santafe.edu/news-center/news/researchers-reveal-bias-in-a-widely-used-measure-of-algo...
1•geox•13m ago•0 comments

Generalized String Art Generator (2023)

https://michael-crum.com/string_art_generator/
1•wonger_•13m ago•0 comments

Do LLMs Understand? AI Pioneer Yann LeCun Spars with DeepMind's Adam Brown [video]

https://www.youtube.com/watch?v=ykfQD1_WPBQ
1•prisenco•13m ago•0 comments

Publisher under fire after 'fake' citations found in AI ethics guide

https://www.thetimes.com/uk/science/article/ai-ethics-guide-citations-nsnjmz25b
2•neilv•15m ago•0 comments

Ask HN: Should the Only Christian Have to Work on Christmas Day

1•supportengineer•20m ago•5 comments

Virustotal: R Client for the VirusTotal Public API v3.0

https://themains.github.io/virustotal/
2•neehao•21m ago•0 comments

Show HN: Go Libraries for Working with OpenAPI

https://github.com/speakeasy-api/openapi
3•mfbx9da4•24m ago•0 comments

nowindows

http://www.fefe.de/nowindows/
8•lr0•27m ago•0 comments

UK to "encourage" Apple and Google to put nudity-blocking systems on phones

https://arstechnica.com/tech-policy/2025/12/uk-to-encourage-apple-and-google-to-put-nudity-blocki...
6•GlumWoodpecker•28m ago•3 comments

CMYK Simulator

https://cmyk.danielpetho.com/
1•dvrp•28m ago•0 comments

Amazon's Aggressive Push to Get Cops Using AI Surveillance

https://www.forbes.com/sites/thomasbrewster/2025/10/01/inside-amazons-aggressive-push-to-get-cops...
3•measurablefunc•32m ago•0 comments

Ukrainian Security Service Struck the Varshavianka (Kilo) Submarine

https://old.reddit.com/r/CombatFootage/comments/1pn9sr8/the_ukrainian_security_service_struck_the/
4•doener•34m ago•1 comments

Killed by Google

https://killedbygoogle.com
5•nervysnail•37m ago•3 comments

I made a network throttle tool controlled by a Chrome extension

https://github.com/harrylincoln/taper
2•hazzamanazza•38m ago•0 comments

Full screen ads in iOS at OS level interactions

https://imgur.com/a/WAuaTFe
3•tsunamifury•39m ago•1 comments

Designing a Passive Lidar Detector Device

https://www.atredis.com/blog/2025/11/20/designing-a-passive-lidar-detection-sensor
2•speckx•44m ago•0 comments

What's the point of lightweight code with modern computers?

https://liam-on-linux.dreamwidth.org/97426.html
2•birdculture•47m ago•0 comments