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

Extortion Using Smart Glasses Is a Thing Now

https://gizmodo.com/extortion-using-smart-glasses-is-a-thing-now-2000755562
1•dataflow•37s ago•0 comments

Show HN: MerryDiv – Track dividends across all your brokerage accounts

https://www.merrydiv.com/
1•zouko•5m ago•0 comments

Tell HN: Starting June 15, claude -p usage will change

1•andersonmvd•9m ago•0 comments

LinkedIn planning to lay off 5% of staff

https://www.reuters.com/business/world-at-work/linkedin-is-planning-lay-off-5-staff-latest-tech-s...
3•doppp•11m ago•1 comments

The Chip War Nobody Saw Coming: Samsung vs. SK Hynix

1•xurgadis•13m ago•0 comments

SwiftUI Is a Disaster

https://ben1777.substack.com/p/swiftui-is-a-disaster
1•bentocorp•16m ago•0 comments

Harvey's Legal Agent Benchmark

https://www.harvey.ai/blog/introducing-harveys-legal-agent-benchmark
1•gmays•19m ago•0 comments

The Ten Commands of the Nine Divines

https://en.uesp.net/wiki/Lore:Ten_Commands:_Nine_Divines
1•alhazrod•20m ago•0 comments

ICE may be at World Cup matches in U.S.

https://www.nbcnews.com/sports/soccer/ice-may-world-cup-matches-us-rcna344797
3•mgh2•21m ago•0 comments

Meta launches WhatsApp 'incognito' mode to address privacy concerns for AI chats

https://apnews.com/article/whatsapp-meta-ai-chatbot-privacy-9a5f7565c969cbf04cf150dfc318cfae
3•devonnull•21m ago•0 comments

Google reports first known real-world AI-crafted zero-day exploit

https://cloud.google.com/blog/topics/threat-intelligence/ai-vulnerability-exploitation-initial-ac...
1•JoheyDev888•22m ago•0 comments

US citizen convicted of running secret Chinese 'police station' in NYC

https://www.bbc.com/news/articles/cy72yy7z1dyo
3•tartoran•26m ago•0 comments

59,000-year-old tooth offers a glimpse into how Neanderthals handled dentistry

https://www.cnn.com/2026/05/13/science/neanderthal-dentistry-stone-drill
1•breve•26m ago•0 comments

Oppositional Federalism: A Taxonomy of State Constitutional Postures Under

https://papers.ssrn.com/sol3/papers.cfm?abstract_id=6416178
1•hkhn•27m ago•0 comments

Alberta judge throws out petition seeking for the province separation

https://www.bbc.com/news/articles/clypn8py4zwo
4•tartoran•28m ago•0 comments

New in Claude Code: ‎`/goal` for autonomous dev loops

https://code.claude.com/docs/en/goal
2•Lwrless•28m ago•0 comments

BYD eyes Stellantis EU plant takeover as EV demand spikes

https://electrek.co/2026/05/13/byd-eyes-stellantis-eu-plant-ev-sales-surge-others-too/
3•breve•30m ago•0 comments

Live Design of ABS (2007)

https://web.archive.org/web/20071011040948/http://www.albinoblacksheep.com/livedesign/
1•arm32•30m ago•0 comments

Cerebras prices IPO at $185 per share to raise $5.55B

https://www.reuters.com/legal/government/cerebras-prices-ipo-185-per-share-raise-555-billion-sour...
4•laixintao•34m ago•0 comments

BYD surpasses Tesla as world’s top energy storage deployer

https://electrek.co/2026/05/13/byd-surpasses-tesla-energy-storage-bess-benchmark-2025/
3•breve•35m ago•0 comments

Federalism for Anti-Fascists

https://medium.com/@carmitage/federalism-for-anti-fascists-e83fb20c6fc2
3•hkhn•38m ago•0 comments

Perl versus Java – The Moving Finger (2025)

https://rant.li/ashwin/perl-versus-java
2•pkaeding•38m ago•0 comments

How Bribery Became Legal

https://medium.com/@carmitage/how-bribery-became-legal-b28dbdf0a41c
2•hkhn•40m ago•1 comments

Show HN: Nibble

https://github.com/glouw/nibble
2•glouwbug•41m ago•0 comments

Feedback Welcome – Feline Finder – explainable AI matching for adoptable cats

https://www.felinefinder.info/
1•gregoryew•41m ago•0 comments

Sound Mode: Can TypeScript Type Checking Be Stricter?

https://tsz.dev/sound-mode/
5•mohsen1•43m ago•0 comments

Cisco Workforce Reductions

https://blogs.cisco.com/news/our-path-forward
4•ahmedomran8•49m ago•0 comments

The inventor hoping to fix your washing machine to stop microplastics

https://www.theguardian.com/environment/2026/may/13/you-have-to-be-where-the-pollution-is-the-inv...
3•thunderbong•59m ago•1 comments

China moves to regulate digital humans - Reuters

https://www.reuters.com/world/china/china-moves-regulate-digital-humans-bans-addictive-services-c...
2•Baljhin•59m ago•2 comments

Dungeons & Desktops: Building a Roguelike with GitHub Copilot CLI

https://github.blog/ai-and-ml/github-copilot/dungeons-desktops-building-a-procedurally-generated-...
1•lee337•1h ago•0 comments