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•9mo 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•9mo 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•9mo 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•9mo 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•9mo ago
Load test against a clone instead of a DB whose contents you care about?

High Speed Rail by Country 2026

https://worldpopulationreview.com/country-rankings/high-speed-rail-by-country
1•thunderbong•1m ago•0 comments

Trend Is Concerning

https://techcrunch.com/2026/02/26/jack-dorsey-block-layoffs-4000-halved-employees-your-company-is...
1•melvinodsa•3m ago•0 comments

Show HN: I built a Chrome extension to record demo videos without editing

https://zoomflow.rovelin.com/
1•hritik7742•8m ago•0 comments

Judge says he will order Greenpeace to pay $345M in oil pipeline case

https://apnews.com/article/greenpeace-energy-transfer-dakota-access-pipeline-30bfb9939dea06f1e976...
1•e2e4•15m ago•0 comments

Model Collapse Ends AI Hype

https://www.youtube.com/watch?v=ShusuVq32hc
2•signa11•17m ago•0 comments

Research suggests mating direction bias between Neanderthals and humans

https://www.theguardian.com/science/2026/feb/26/male-neanderthals-human-females-mating-research-d...
2•uxhacker•18m ago•0 comments

Seeing Is Not Believing: Benchmarking AI Image Detectors

https://blog.succinct.xyz/ai-image-detection-benchmark/
1•ncb9094•18m ago•0 comments

Pakistan bombs targets in Afghan cities, minister calls it 'open war'

https://www.reuters.com/world/asia-pacific/pakistan-strikes-afghanistan-targets-clashes-intensify...
1•petethomas•19m ago•0 comments

How Stupid Would It Be to Put Data Centers in Space?

https://spectrum.ieee.org/orbital-data-centers
1•amaks•22m ago•1 comments

Upload 23andMe,myHeritage, Myancestry, get 1,200 GRS score and a longevity prot

1•HelixSequencing•23m ago•0 comments

Dear Time Lords: Freeze Computers in 1993

https://graydon2.dreamwidth.org/322461.html
5•zdw•31m ago•0 comments

Reduce Claude Token Usage by 50%

https://ham-pro.vercel.app/
2•Luseniik•31m ago•1 comments

Making Video Games in 2025 (without an engine)

https://www.noelberry.ca/posts/making_games_in_2025/
2•alvivar•31m ago•0 comments

How do you evaluate a person's ability to use AI?

3•imwoody•34m ago•1 comments

Secure-Massively-Multiplayer-Snake

https://eieio.games/blog/secure-massively-multiplayer-snake/
2•colinprince•34m ago•0 comments

Claude-search – grep, resume your Claude Code session history from the CLI

https://github.com/pi-netizen/claude-search
2•pi-netizen•35m ago•1 comments

Under Secretary of Defense Emil Michael Response to Dario Amodei

https://xcancel.com/uswremichael/status/2027211708201058578?s=12
4•grej•36m ago•2 comments

Green Eggs and HAM (Hierarchical Agent Memory)

https://github.com/kromahlusenii-ops/ham
3•Luseniik•38m ago•1 comments

Energym: Move the World

https://www.aicandy.be/giorgio-1
2•zdw•40m ago•0 comments

Tonka beans are illegal in the US

https://www.bbc.com/future/article/20170620-the-delicious-flavour-with-a-toxic-secret
4•valzevul•41m ago•0 comments

OpenClaw Hype: Analysis of Chatter from the Dark Web (BleepingComputer)

https://www.bleepingcomputer.com/news/security/the-openclaw-hype-analysis-of-chatter-from-open-so...
2•ildar•44m ago•0 comments

Any Website Can Take Full Control of Your OpenClaw Agent (Oasis)

https://www.oasis.security/blog/openclaw-vulnerability
1•ildar•45m ago•0 comments

Show HN: Cecil – open-source memory and identity protocol for AI

https://github.com/johnkf5-ops/cecil-protocol
1•JohnKnopf•48m ago•1 comments

New AirSnitch attack breaks Wi-Fi encryption in homes, offices, and enterprises

https://arstechnica.com/security/2026/02/new-airsnitch-attack-breaks-wi-fi-encryption-in-homes-of...
1•brie22•49m ago•1 comments

Show HN: HeadshotAI – Professional AI headshots in 30 seconds for £4.99

https://headshotai-mvp-jb.netlify.app
1•jackbventures•57m ago•3 comments

China piles pressure on Japan after Takaichi Sanae's triumph

https://www.economist.com/asia/2026/02/26/china-piles-pressure-on-japan-after-takaichi-sanaes-tri...
3•petethomas•1h ago•0 comments

The Cron King

http://thecronking.com/
2•thebuilderjr•1h ago•0 comments

Can LLMs reason about math? The Subtraction Trick Test

https://haversine.substack.com/p/can-llms-reason-about-math-the-subtraction
4•MakeAJiraTicket•1h ago•2 comments

Show HN: Toggl lock‑screen widget for real‑time time tracking

https://apps.apple.com/ca/app/toggl-lockscreen-widget/id6756894639
2•dakoder36•1h ago•0 comments

How Anthropic Teams use Claude Code [pdf]

https://www-cdn.anthropic.com/58284b19e702b49db9302d5b6f135ad8871e7658.pdf
5•carlsborg•1h ago•0 comments