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?

Anti-Fascist PieFed Features

https://join.piefed.social/2026/08/04/anti-fascist-piefed-features/
1•birdculture•1m ago•0 comments

The Allure and Peril of Riding an Alaskan Wave for Six Miles

https://www.nytimes.com/2026/08/02/us/bore-tide-surfing-alaska.html
1•bookofjoe•1m ago•1 comments

NYC Metro Card Machines to Be Auctioned Off

https://www.mta.info/article/mvm-mem-sale
1•teddygraham•1m ago•0 comments

C++26: Embed

https://www.sandordargo.com/blog/2026/08/05/cpp26-embed
1•jandeboevrie•1m ago•0 comments

Something Is Changing in the Unit Economics of Software

https://nicolo.xyz/something-is-changing-in-the-unit-economics-of-software/
1•coconido•2m ago•0 comments

Engineering around WAL backpressure in Postgres

https://clickhouse.com/blog/wal-backpressure-clickhouse-managed-postgres
1•saisrirampur•2m ago•0 comments

A Survey on LLM-as-a-Judge

https://arxiv.org/abs/2411.15594
1•Anon84•3m ago•0 comments

Show HN: OpenEdit – fast, open Source video editing agent

https://github.com/veedstudio/open-edit
1•sabbakeynejad•3m ago•0 comments

Show HN: Torum TUI Access [video]

https://gitlab.com/here_forawhile/torumplus/-/raw/main/Torum_CLI_Demo.mp4
1•smalltorch•6m ago•0 comments

Compiler Explorer Runs on AWS in 2026

https://xania.org/202608/how-compiler-explorer-runs-on-aws
1•jandeboevrie•7m ago•0 comments

Buddhist AI Research

https://www.anicka.net/research/
1•skywalqer•7m ago•0 comments

We're in Web 3.0

https://agatalab.ai/writing/web3
1•ciesaga•10m ago•0 comments

9 out of 10 bestselling novels in UK have 1 thing in common: a woman is murdered

https://www.theguardian.com/books/2026/jul/14/nine-of-ten-bestselling-novels-uk-woman-murdered
2•breitling•10m ago•0 comments

Denial WM: New Wayland Compositor with Flutter Directly Embedded

https://www.phoronix.com/news/Denial-WM-Compositor
1•mikece•11m ago•0 comments

Discovery Loop

https://www.discoveryloop.com/
4•xtreak29•11m ago•0 comments

Why do OpenAI's GPT-2 weights beat mine?

https://www.gilesthomas.com/2026/07/why-do-openai-gpt2-weights-beat-mine-1-intro
1•gmays•12m ago•0 comments

Pokee-Isaac 28B: 10M-token context, deployable on a single GPU

https://twitter.com/Pokee_AI/status/2084682445648216383
1•handfuloflight•15m ago•0 comments

Show HN: I made alchemical-cosmological PCB badges

https://github.com/KaiPereira/Alchemical-Cosmological-Badges
1•kaipereira•15m ago•0 comments

Hologram v0.11: Regular Expressions, Client Stacktraces, and More

https://hologram.page/blog/hologram-v0-11
1•bartblast•15m ago•0 comments

Jeff Dean Leaving Google

https://twitter.com/JeffDean/status/2085034604172603724
10•bifftastic•16m ago•0 comments

Google's Chief Scientist Is Leaving After 27 Years–To Start His Own AI Company

https://www.wsj.com/tech/ai/googles-chief-scientist-is-leaving-after-27-yearsto-start-his-own-ai-...
4•lairv•16m ago•0 comments

Same $24 AWS Lightsail VM, Different Bang for Buck by Region

https://webbynode.com/articles/bang-for-buck-2-aws-lightsail-24-dollar-vm
1•gsgreen•17m ago•0 comments

Measure coding agents in hardened environments

https://boundarybench.com/
2•aviramha•18m ago•0 comments

Show HN: Diffing Binary Files

https://withkord.com/diff
4•wennyyustalim•18m ago•0 comments

Google Is a Scammer's Paradise

https://pluralistic.net/2026/08/05/absentee-landlord/
3•hn_acker•19m ago•0 comments

The World Is Running Out of River Sand, and That's an Issue

https://www.sciencealert.com/the-worlds-rivers-are-running-out-of-sand
1•thunderbong•19m ago•0 comments

Google chief scientist Jeff Dean leaving in AI reshuffle

https://www.cnbc.com/2026/08/05/google-chief-scientist-jeff-dean-leaving-company-after-27-years.html
4•adolph•20m ago•0 comments

How do newborns react to the smell of their fathers?

https://www.npr.org/2026/08/04/nx-s1-5910665/how-do-newborns-react-to-the-smell-of-their-fathers
1•Brajeshwar•20m ago•0 comments

Show HN: AppScout – App Store downloads, revenue and widgets

https://apps.apple.com/us/app/appscout-app-metrics/id6770866569
1•degisner•21m ago•0 comments

Gödel, Escher, Elisp: The Beauty of Macros

https://www.chiply.dev/post-elisp-macros-are-beautiful
1•ibobev•23m ago•0 comments