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?

Famous actors arriving in the vertical drama no longer just bring romance

https://www.duanju.news/en/post/famous-actors-duanju-romance
1•lbostral•36s ago•0 comments

The Cryptopals Crypto Challenges

https://cryptopals.com/
1•sebg•2m ago•0 comments

Clankers Made Me Build a Second Brain

https://jadarma.github.io/blog/posts/2026/09/clankers-made-me-build-a-second-brain/
1•birdculture•2m ago•0 comments

Silicon Valley 'sex assault list' with 'over 100' names circulated

https://nypost.com/2026/09/24/tech/silicon-valley-sex-assault-list-with-over-100-names-circulated...
1•Anon84•3m ago•0 comments

Midden, a JVM heap dump analyser in a single static binary

https://github.com/NullByte3/midden/
1•deboi02•4m ago•1 comments

Reimagining research papers as interactive and reliable AI agents

https://www.nature.com/articles/s41586-026-11044-y
1•JohnHammersley•6m ago•0 comments

I got Opus 5.5 to make a whimsical video ad for my side hustle

https://www.reddit.com/r/ClaudeAI/comments/1wptwrk/got_opus_55_to_build_an_advert_for_my_side_hus...
2•beatthatflight•6m ago•0 comments

Causal questions and the jobs program data

https://stochastic.blog/causal-questions-and-the-jobs-program-data/
1•Anon84•8m ago•0 comments

Platform-Independent SIMD in Go

https://go.dev/blog/simd-experiment
1•yurivish•9m ago•0 comments

The Biggest Risk of AI Wearables Is Not Personal Privacy – It's Human Agency

https://papers.ssrn.com/sol3/papers.cfm?abstract_id=7498938
3•hogwash•9m ago•0 comments

Kilo for JetBrains is now a multi-agent control room

https://blog.kilo.ai/p/kilo-for-jetbrains-a-multi-agent-control-room
1•Aireen5858•10m ago•0 comments

Hardlist: Index of ambitious European hardware startups

https://www.hardli.st/
1•nanna•10m ago•0 comments

Double-entry accounting for compute time

https://sfcompute.com/news/abel-ledger
1•samuelselleck•11m ago•0 comments

Accelerating the Kernel's Build Process

https://lwn.net/Articles/1093398/
1•rbanffy•12m ago•0 comments

Mdash as a Service

https://xn--rtj.tsak.dev
2•tsak•12m ago•1 comments

Meta needs you to believe it cares about privacy

https://www.axios.com/2026/09/25/meta-ai-muse-privacy
2•1vuio0pswjnm7•13m ago•0 comments

A Rock Is Trapped Light [video]

https://www.youtube.com/watch?v=f8O3XMrC8hg
3•binyu•13m ago•0 comments

All be asking more questions

https://www.seangoedecke.com/you-should-all-be-asking-way-more-questions/
1•MaxMussio•13m ago•1 comments

The Hollow Pursuit of Happiness

https://medium.com/@IvyBealtaine/the-hollow-pursuit-of-happiness-0508ee582876
1•szamski•14m ago•1 comments

GPT 6 Astra beat NetHack

https://kenforthewin.github.io/blog/posts/llm-nethack-ascension/
2•enad•16m ago•0 comments

Code Review Says Less

https://openteams.com/best-code-reviews-say-less/
2•johnnybouder•16m ago•0 comments

Git-bug: Distributed, offline-first bug tracker embedded in Git

https://github.com/git-bug/git-bug
3•alentred•17m ago•0 comments

Fueling a Return Journey from Mars – Massachusetts Institute of Technology

https://news.mit.edu/2026/fueling-return-journey-from-mars-lanie-mckinney-0918
1•rbanffy•18m ago•0 comments

Walden. Build Deliberately

https://walden.so/
1•focused_morning•22m ago•0 comments

ZapFast

https://zapfast.rocks/
1•earcar•23m ago•2 comments

Don't Trust the Super-App: A Case Study of Russia's Max

https://arxiv.org/abs/2609.11814
1•sysoleg•26m ago•0 comments

Retries Turn a Short Outage into a Long One

https://blog.dochia.dev/blog/retries/
1•ludovicianul•27m ago•0 comments

Show HN: Herobrine – Minecraft buddies using jev

https://github.com/xatuke/herobrine
2•satuke•30m ago•0 comments

How to Create WebRTC Publisher Clients with Adaptive Live Encoding

https://www.red5.net/blog/how-to-create-webrtc-publisher-clients-with-adaptive-live-encoding/
2•mondainx•30m ago•0 comments

Reverse Engineering a Pellet Stove Remote with Codex

https://itunsecurity.wordpress.com/2026/09/25/mcz-musa-2-0-air-an-esphome-remote-for-home-assistant/
1•dud3333•31m ago•1 comments