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

MikroORM 7: Unchained

https://mikro-orm.io/blog/mikro-orm-7-released
1•bundie•22s ago•0 comments

Show HN: Bucket Delta – Compute differences between two S3-compatible buckets

https://github.com/nutanix/bucket-delta-cli
1•drstrange14•2m ago•0 comments

Show HN: I built an AI that forgets things when people leave the room

https://takt.chat/
1•mtrifonov•3m ago•0 comments

Local-heatmap-tile-server v1

https://nuxx.net/blog/2026/04/07/local-heatmap-tile-server-v1/
2•c0nsumer•3m ago•0 comments

Is the United States a Terrorist State?

https://factually.co/fact-checks/politics/is-the-us-a-terrorist-state-question-explained-ab1d53
2•only_in_america•3m ago•0 comments

AI Agent Guardrails: Pre-LLM and Post-LLM Best Practices

https://www.arthur.ai/blog/best-practices-for-building-agents-guardrails
1•pevals•4m ago•0 comments

Same LLM but different output: we built a CI specialist

https://www.mendral.com/blog/same-llm-different-agent
1•shad42•4m ago•0 comments

Good Taste the Only Real Moat Left

https://rajnandan.com/posts/taste-in-the-age-of-ai-and-llms/
2•speckx•5m ago•2 comments

I tried building a home lab using Illumos distros

https://www.xda-developers.com/i-tried-building-a-home-lab-using-illumos-distros/
1•herecomesthepre•5m ago•0 comments

Show HN: Seek – Context-aware terminal search TUI

https://github.com/vishruthb/seek
1•vishruthbharath•6m ago•0 comments

Show HN: NeverDue – turn emails into calendar events, exports as ICS

https://neverdue.ca
1•vicnas•6m ago•0 comments

"Amazing Refresh" - A Malicious Chrome Extension

https://scotthelme.co.uk/amazing-refresh-a-malicious-chrome-extension-running-malware-in-the-brow...
2•moebrowne•7m ago•0 comments

Adaptive Thinking Doesn't Change Quality. It Changes Variance

https://vexjoy.com/posts/adaptive-thinking-variance/
1•AndyNemmity•8m ago•0 comments

Ask HN: Why isn't Anthropic eating their own dogfood? A Max subscriber's view

1•jandoze•8m ago•0 comments

12k Tons of Dumped Orange Peel Grew into a Landscape Nobody Expected (2017)

https://www.sciencealert.com/how-12-000-tonnes-of-dumped-orange-peel-produced-something-nobody-im...
6•pulisse•12m ago•0 comments

U.S. Official Sarah Rogers Visits Korea, Criticizes Censorship Bill

https://www.chosun.com/english/world-en/2026/03/28/WK7NJTRR5BFNRI6U3FFEQNO5UI/
1•mooreds•13m ago•0 comments

AMD's senior director of AI thinks 'Claude has regressed'

https://www.pcgamer.com/software/ai/amds-senior-director-of-ai-thinks-claude-has-regressed-and-th...
1•evo_9•14m ago•0 comments

Safeguarded AI

https://aria.org.uk/opportunity-spaces/mathematics-for-safe-ai/safeguarded-ai/
2•mooreds•14m ago•0 comments

Are Local LLMs Good Enough for Vibe Coding? Gemma4-26B-A4B vs. Qwen3.5-35B-A3B

https://grigio.org/are-local-llms-good-enough-for-vibe-coding-gemma4-26b-a4b-vs-qwen3-5-35b-a3b/
2•grigio•15m ago•0 comments

The Future of Everything Is Lies, I Guess

https://aphyr.com/posts/411-the-future-of-everything-is-lies-i-guess
2•Tomte•16m ago•0 comments

I Built a Wiki LLM

https://99helpers.com/wiki/security-kb
1•nickk81•16m ago•2 comments

AI Will Not Make You Rich

https://colossus.com/article/ai-will-not-make-you-rich/
3•speckx•17m ago•1 comments

Diffuse AI Issue 1

https://www.diffuseai.pub/p/diffuse-ai-issue-1
1•charlesxjyang•17m ago•1 comments

What causes most App Store rejections in your workflow?

https://appcompliance.io/
1•Eryq•18m ago•0 comments

Show HN: Dial Tone – an iOS rhythm game inspired by Slide to Unlock

https://fidgetwinner.com/making-dialtone
1•fidgetwinner•19m ago•0 comments

Show HN: Developed a solution to automate ASO keyword research

https://respectaso.com/
1•sinthes•20m ago•0 comments

DispoRx: Using Agentic AI as a high-fidelity simulator for ER workflows

https://www.disporx.com/resources/disporx-launches-agentic-ed
1•chmoder•20m ago•1 comments

.env is safe but your –/.claude is not

https://github.com/PrismorSec/immunity-agent/blob/main/README.md
6•noobcoder•21m ago•2 comments

Slople – Can you tell real ML papers from AI-generated ones?

https://ml5885.github.io/slople/
2•bearseascape•22m ago•1 comments

Show HN: Kindling – reverse-engineered kindlegen, ~7,000x faster in Rust

https://github.com/ciscoriordan/kindling
1•ciscoriordan•22m ago•0 comments