frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Ask HN: How can I load test PostgreSQL but avoid changing actual data?

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

Show HN: Satroot – signed event logs you can verify offline, no server

https://satroot.com/
1•parthod0x•28s ago•0 comments

Productivity Inflation: Why Everyone's More Efficient but Not Earning More

https://chinaonchina.com/article/efficiency-inflation-why-being-more-productive-isn-t-making-us-r...
1•try-working•1m ago•0 comments

TikTok Videos: 4.5B posts with engagement metrics

https://huggingface.co/datasets/kuben-developer/tiktok-videos-4b
1•plurby•3m ago•0 comments

Grassroots Football, Live

https://unleague.site/
2•kunalsin9h•5m ago•0 comments

We Thought Hubble Was One of a Kind with Its 2.4-Meter Mirror

https://www.spacegroup.no/we-thought-hubble-was-one-of-a-kind-with-its-2-4-meter-mirror-but-an-am...
1•mooreds•5m ago•0 comments

A dark horse enter China's AI race: StartLux

https://chinaonchina.com/article/chen-dawei-returns-enters-the-large-model-sector
1•try-working•6m ago•0 comments

Federal government surveilling professional lobstermen

https://www.washingtonpost.com/opinions/2026/09/02/federal-government-is-surveilling-professional...
1•bookofjoe•6m ago•1 comments

Show HN: Play Hide and Seek vs. a Self-Improving Agent Using WebMCP

https://lightcone-webmcp.netlify.app/
3•bearfjellstad•7m ago•0 comments

Review of "The Box"

https://www.eyrie.org/~eagle/reviews/books/0-691-13640-8.html
1•mooreds•9m ago•0 comments

Returning from the AI brain-rot state, re-take the thinking ownership

2•tuleiff•11m ago•0 comments

Mark Cuban: Why US hospitals "don't know their costs"

https://www.beckershospitalreview.com/finance/mark-cuban-why-us-hospitals-dont-know-their-costs/
1•elo2000•12m ago•0 comments

Child abuse survivor sues xAI, alleging Grok generated new illegal images of her

https://www.theguardian.com/technology/2026/sep/03/elon-musk-ai-grok-child-porn-lawsuit
1•sbulaev•12m ago•0 comments

AI-assisted mushroom hunting is a recipe for a bad trip

https://www.theregister.com/offbeat/2026/09/02/ai-assisted-mushroom-hunting-is-a-recipe-for-a-bad...
1•pseudolus•14m ago•0 comments

From Click-Ops to IaC: A Safer Workflow with AI

https://masterpoint.io/blog/dont-let-ai-break-your-infra/
1•mooreds•15m ago•0 comments

My AI agent kept waiting on me. I built a VS Code extension to fix that

https://github.com/chahe-dridi/vscode-agent-bell
1•chaherdridi•15m ago•0 comments

Scaling agentic AI pilots across the enterprise

https://www.technologyreview.com/2026/09/03/1142868/scaling-agentic-ai-pilots-across-the-enterprise/
1•joozio•16m ago•0 comments

Qwen-Drive-1.0

https://arxiv.org/abs/2609.00111
2•amancina79•17m ago•0 comments

A walk across the playa to the Temple, under the sky over it now

https://theplaya.net
2•slngr•17m ago•0 comments

Biting the No-Self Bullet

https://sashachapin.substack.com/p/biting-the-no-self-bullet
2•eatitraw•18m ago•0 comments

Google Antigravity TOS: 3rd party usage can get Google account suspended

https://twitter.com/GergelyOrosz/status/2095453567955968398
2•tosh•18m ago•0 comments

Show HN: KeyKosh(K2) – Self-hosted config and secret manager

https://keykosh.com/
1•prasols•20m ago•1 comments

Show HN: Cut your AI bill by a third. Same tools, same output

https://www.getfemail.com
1•not_wowinter14•22m ago•0 comments

Show HN: Vocab.design – A visual dictionary of UI and design terms

https://vocab.design/
1•krtgkn•23m ago•0 comments

40 years later, are Bentley's "Programming Pearls" still relevant?

https://shkspr.mobi/blog/2025/09/40-years-later-are-bentleys-programming-pearls-still-relevant/
1•edent•23m ago•0 comments

Why Is Guangdong New Energy Reporting Negative Electricity Prices?

https://chinaonchina.com/article/why-is-guangdong-new-energy-reporting-negative-electricity-price...
1•try-working•24m ago•0 comments

More than 100 water systems were hit in July cyberattacks

https://www.theregister.com/cyber-crime/2026/08/26/more-than-100-water-systems-were-hit-in-july-c...
1•NordStreamYacht•26m ago•0 comments

Audacity 4.0

https://github.com/audacity/audacity/releases/tag/Audacity-4.0.0
4•ClydeN•26m ago•0 comments

AnnotationSync a KOReader's plugin to sync between devices

https://github.com/dani84bs/AnnotationSync.koplugin
1•greensquare•26m ago•0 comments

Android 17 and higher includes a Memory Limiter

https://source.android.com/docs/core/perf/memory-limiter
2•nisiddharth•29m ago•1 comments

The Perpetual Tourist Experiment

https://experimentalliving.substack.com/p/the-perpetual-tourist-experiment
1•soltanov•29m ago•0 comments