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?

Don't let a misunderstanding distract you from your goals

https://herbertlui.net/dont-let-a-misunderstanding-distract-you-from-your-goals/
1•herbertl•3m ago•0 comments

Regularized RSI

https://regularized-rsi.com/
1•gregorymichael•4m ago•0 comments

SERV – The SErial RISC-V CPU

https://github.com/olofk/serv
1•kristianpaul•6m ago•0 comments

Tensorlake NPM package and repo compromised

https://github.com/tensorlakeai/tensorlake/issues/1014
2•varunsharma07•10m ago•0 comments

A DuckDB Database with No Data in It

https://duckdb.org/2026/10/07/view-only-mode
1•eigenBasis•15m ago•0 comments

Retrofitting language models to operate over bytes

https://www.nature.com/articles/s41586-026-11111-4
2•theanonymousone•19m ago•0 comments

Deveggs – a self evolving developer eggsperience

1•kunggaochicken•21m ago•0 comments

The mysterious pneumonia in Russia deserves attention, not panic

https://www.statnews.com/2026/10/06/russia-plague-reports-pneuomonia-siberia-expert-calm/
2•EA-3167•24m ago•1 comments

Where Are the Builders?

https://near.blog/where-are-the-builders/
1•yarapavan•24m ago•0 comments

RetinaRelay – A Second Life for Your iMac

https://www.retinarelay.com/
2•tambourine_man•29m ago•0 comments

Runtime – Your AI Agents Have a Home

https://withruntime.com/
1•shermansingh•30m ago•1 comments

Trust Me, You Want SunOS 4.1.4 on Your Older Sun Boxes

https://oldsilicon.com/technologies/sunos-414-older-sun-boxes/
1•caned•32m ago•0 comments

Show HN: Agentc: <1MB static, no Libc, minimal, embeddable agent with Rust/C API

https://github.com/abird-ai/agentc
2•logxroot•41m ago•0 comments

SaaS RFP – post and bid on SaaS in public

https://saasrfp.com
1•danielandrews43•41m ago•1 comments

Trump plans to charge international students $70k for work authorization

https://www.reuters.com/legal/government/trump-administration-plans-charge-international-students...
1•onemoresoop•41m ago•0 comments

Agent Collaboration over Unreliable Channels

https://spakhm.com/projects/bitfuse.html
1•rzk•42m ago•0 comments

Free Unlimited Fish Audio Text to Speech

https://www.fish-audio.org/
2•wsm123456•43m ago•0 comments

The Dot and the Swarm

https://www.oneusefulthing.org/p/the-dot-and-the-swarm
1•gmays•45m ago•0 comments

Building alone, faster: a panel on what AI is doing to the product trio

https://jennywanger.com/articles/building-alone-faster/
2•mooreds•50m ago•0 comments

A common language for game telemetry

https://briangilbert.net/writings/local-telemetry-standard/
1•realityloop•52m ago•0 comments

Don't make me type my business in twice: what tour operators need from software

https://justinsmith.build/writing/dont-make-me-type-it-twice/
3•s14jsmith•53m ago•0 comments

Exodus AI – Affordable face swapping tool for creators

https://tally.so/r/44gGAB
4•godwinokuli•53m ago•0 comments

What I learned leaving a Ruth AI in charge

https://silavapi.co.uk/blog/what-i-learned-leaving-a-ruth-ai-in-charge/
1•mooreds•54m ago•0 comments

Evolutionary Refactoring: Let Agents Invent Codebase-Specific Patterns

https://adamtornhill.substack.com/p/evolutionary-refactoring-let-agents
1•mooreds•55m ago•0 comments

SpaceX's recovered Starship after Flight 13 splashdown returns to Texan port

https://www.floridatoday.com/story/tech/science/space/spacex/2026/10/07/spacex-brings-home-first-...
2•bookmtn•58m ago•0 comments

US Man Given Prison Sentence for Bot-Farming Music Streams

https://thequietus.com/news/us-man-given-prison-sentence-for-bot-farming-music-streams/
3•cdrnsf•1h ago•2 comments

Show HN: Chromatics, a classics reader that colors every character's dialogue

https://chromatics.mobile/
1•mchromatics•1h ago•0 comments

BuzzSearch MCP extracts exact words your target customer uses

https://buzzsearch.ai/mcp
1•zhizdev•1h ago•0 comments

OSHotspot, WiFi hotspot manager for Linux with a live security dashboard

https://github.com/King03-sam/OSHotspot
1•olojedesamuel•1h ago•0 comments

In Defense of Western Civilization by Marco Rubio

https://statedept.substack.com/p/in-defense-of-western-civilization
2•7777777phil•1h ago•2 comments