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

Apfel Chat – Private on Device AI That Works in Airplane Mode (MIT)

https://apfel-chat.franzai.com/
1•franze•1m ago•0 comments

Maestri – Infinite Canvas for coding agents

https://www.themaestri.app/en
1•surrTurr•2m ago•0 comments

AI-powered English pronunciation practice

https://github.com/xialeistudio/echoic
1•xialeistudio•2m ago•0 comments

Show HN: Lodmem – Level of Detail Context Management for Agents

https://github.com/agenteractai/lodmem
1•mribbons•4m ago•0 comments

Show HN: Wiktionary StarDict Files

https://xxyzz.github.io/wiktionary_stardict/
1•xxyzz•4m ago•0 comments

Energy storage breakthrough traps sunlight in a molecule

https://newatlas.com/energy/sunlight-solar-energy-molecule-pyrimidone-ucsb/
1•breve•5m ago•0 comments

AI sheds light on an ancient gaming mystery

https://news.flinders.edu.au/blog/2026/03/21/ai-sheds-light-on-an-ancient-gaming-mystery/
1•breve•7m ago•0 comments

How do Wake-On-LAN works

https://blog.xaner.dev/post/wake-on-lan/
1•swq115•13m ago•0 comments

Amid housing shortage, migration stalls in disaster-hit Fukushima towns

https://www.japantimes.co.jp/news/2026/03/16/japan/fukushima-housing-shortage/
1•PaulHoule•14m ago•0 comments

Startup Wants You to Pay Up to Talk with AI Versions of Human Experts

https://www.wired.com/story/onix-substack-ai-platform-therapy-medicine-nutrition/
1•joozio•15m ago•0 comments

Show HN: Hormuz Havoc, a satirical game that got overrun by AI bots in 24 hours

https://www.hormuz-havoc.com/
1•kupadapuku•19m ago•0 comments

Antibacterial Herbs: Ancient Remedies, Modern Science

https://worldsensorium.com/antibacterial-herbs-ancient-remedies-modern-science/
1•dnetesn•23m ago•0 comments

Soppo: Golang, with the features it's missing

https://soppolang.dev/?2
1•networked•24m ago•0 comments

John Burroughs: "The Incense of April"

https://worldsensorium.com/john-burroughs-the-incense-of-april/
1•dnetesn•24m ago•0 comments

MoonBit 0.9: Introducing First-Class Formal Verification

https://twitter.com/i/status/2042553809159729576
2•hongbo_zhang•27m ago•0 comments

Axios request smuggling via prototype pollution – Critical (CVSS 9.9)

https://github.com/advisories/GHSA-fvcv-3m26-pcqx
2•akhs•28m ago•1 comments

Self-hosted GitHub Wrapped – weekly AI report deployed to GitHub Pages

https://github.com/HimashaHerath/github-dev-wrapped
1•himasha_47•30m ago•1 comments

Oilfield Units: a Measurement System so Cursed it made me Change Career [video]

https://www.youtube.com/watch?v=sdWEGzWFcCc
1•bryanrasmussen•30m ago•0 comments

The New Feudalism: AI Reshaping Power, Labor; Case for Self-Reliant Communities

https://plantthevillage.com/
2•Terretta•31m ago•0 comments

The Barrier Between Source Code and Compiled Code Has Dissolved

https://calebfenton.substack.com/p/the-barrier-between-source-code-and
1•calebfenton•31m ago•2 comments

Architecture, patterns and internals of Anthropic's AI coding agent

https://github.com/alejandrobalderas/claude-code-from-source
3•Anon84•36m ago•0 comments

Do founders' political views affect how you see a product?

2•rishikeshs•41m ago•2 comments

I Just Want Simple S3

https://blog.feld.me/posts/2026/04/i-just-want-simple-s3/
2•g0xA52A2A•41m ago•0 comments

Ask HN: Easiest UX for Seniors

1•khoury•45m ago•0 comments

My app hit 1,152 first-time downloads in a single day

1•apoorvdarshan•47m ago•0 comments

AI and Tech brief: Ireland ascendant

https://www.washingtonpost.com/wp-intelligence/ai-tech-brief/2026/04/03/ai-tech-brief-ireland-asc...
1•rbanffy•51m ago•0 comments

Show HN: SubnetLens – a concurrent local network scanner built in Go with a TUI

https://github.com/ostefani/subnetlens
1•ostefani•54m ago•0 comments

Claude Agents SDK: a process per session, each starting at 214MB on macOS

https://twitter.com/josevalim/status/2042908631474069660
2•tosh•54m ago•0 comments

Stopping to think about the AI context

https://github.com/Titovilal/context0
1•titovilal•54m ago•1 comments

Twometer/NoFences: open-source Stardock Fences alternative

https://github.com/Twometer/NoFences
1•ankitg12•1h ago•0 comments