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?

Perplexity Computer Is Groundbreaking

https://karozieminski.substack.com/p/perplexity-computer-review-examples-guide
2•Lunaboo•2m ago•0 comments

Jack Dorsey Blamed AI for Block's Layoffs. Skeptics Aren't Buying It

https://www.wsj.com/business/jack-dorseys-latest-far-out-bet-an-ai-future-with-fewer-employees-25...
1•nradov•2m ago•0 comments

A new 'uncertainty relation' for quantum measurement errors

https://phys.org/news/2026-03-uncertainty-quantum-errors.html
1•bikenaga•2m ago•0 comments

Building an Elite AI Engineering Culture in 2026

https://www.cjroth.com/blog/2026-02-18-building-an-elite-engineering-culture
1•mooreds•2m ago•0 comments

Idaho considers an 'apocalyptic' choice for disabled people and families

https://19thnews.org/2026/03/idaho-medicaid-budget-cuts-disability-programs/
1•mooreds•3m ago•0 comments

Where AI Agents Are Heading: What We Learned from Recent YC Startups

https://e2b.dev/blog/yc-companies-ai-agents
1•tizkovatereza•7m ago•2 comments

Show HN: AgentCost – Track, control, and optimize your AI spending (MIT)

https://github.com/agentcostin/agentcost
1•agentcostin•7m ago•0 comments

Spectre I prevents smart devices and AI recorders from picking up your voice

https://www.deveillance.com/
1•tnorthcutt•8m ago•1 comments

Show HN: VideoEvaluator, a Video Comparison Tool

https://www.videoevaluator.com/
1•ekinertac•9m ago•0 comments

Show HN: AI tool that brutally roasts your AI agent ideas

https://whycantwehaveanagentforthis.com
1•Sattyamjjain•10m ago•0 comments

Toyota Once Used a Fake Dining Room Set to Teach Execs How Big Americans Are

https://www.thedrive.com/news/toyota-once-used-a-fake-dining-room-set-to-teach-executives-how-big...
2•coloneltcb•11m ago•0 comments

Show HN: Agent Action Protocol (AAP) – MCP got us started, but is insufficient

https://github.com/agentactionprotocol/aap/
2•hank2000•11m ago•0 comments

Deveillance Spectre I blocks smart devices and AI recorders

https://twitter.com/aidaxbaradari/status/2028864606568067491
3•geekfactor•12m ago•1 comments

The Attention Tax

https://www.afox.dev/posts/the-attention-tax
1•wtfox•14m ago•0 comments

Attacks on GPS Spike Amid US and Israeli War on Iran

https://www.wired.com/story/gps-attacks-on-ships-spike-amid-the-us-and-israeli-war-on-iran/
1•speckx•14m ago•0 comments

Show HN: The Nova: Evolution for Evolution's Sake

https://fuchsia-broad-flamingo-157.mypinata.cloud/ipfs/bafybeihc6mom4oowr6afzofxi7gzpnrsi3smaruur...
1•Novaga•15m ago•0 comments

Justice Department Seeks to Reverse Course and Defend Law Firm Sanctions

https://www.wsj.com/us-news/law/justice-department-seeks-to-reverse-course-and-defend-law-firm-sa...
3•JumpCrisscross•15m ago•0 comments

Why MAGA suddenly loves solar power

https://www.washingtonpost.com/business/2026/03/02/katie-miller-solar-power-trump/
1•standeven•17m ago•0 comments

Show HN: RUOK – Self-hosted personal OKR system with AI-powered analytics

https://github.com/zli117/RUOK/
1•lzl1234•18m ago•0 comments

Show HN: VibePod CLI – Run AI agents with isolation and better observability

https://vibepod.dev/
1•nezhar•19m ago•0 comments

Block's Jack Dorsey thinks AI can do 40% of his job

https://www.theguardian.com/technology/2026/mar/03/jack-dorsey-block-ai-worker-jobs
2•skor•21m ago•0 comments

Show HN: A runtime authorization layer for AI agents

2•rkka•21m ago•0 comments

Bash Is Not Enough: Why Large-Scale CI Needs an Orchestrator

https://www.iankduncan.com/engineering/2026-02-06-bash-is-not-enough/
2•PaulHoule•24m ago•0 comments

Why Your Company's Digital Sovereignty Is a House of Cards

https://medium.com/@gastonbehar/why-your-companys-digital-sovereignty-is-a-house-of-cards-556b31c...
2•gastonbehar•24m ago•1 comments

Why Test Environments Fail and What Top Teams Do to Avoid the Chaos

https://sdtimes.com/test/why-test-environments-fail-and-what-top-teams-do-to-avoid-the-chaos/
2•mikece•24m ago•0 comments

Easterlin Paradox

https://en.wikipedia.org/wiki/Easterlin_paradox
2•gessha•25m ago•0 comments

Claude is an Electron App because we've lost native

https://tonsky.me/blog/fall-of-native/
3•todsacerdoti•25m ago•0 comments

Show HN: OculOS – Any desktop app as a JSON API via OS accessibility tree

https://github.com/huseyinstif/oculos
2•stif1337•25m ago•0 comments

Nvidia-backed Ayar Labs raises $500M at $3.75B valuation

https://www.reuters.com/technology/nvidia-backed-ayar-labs-raises-500-million-375-billion-valuati...
3•abe94•25m ago•0 comments

Show HN: Xenith.ai – Web Assembly Based Voice Assistant with WebLLM/Whisper/VITS

https://xenith.ai
2•cppshane•26m ago•0 comments