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?

A24 Is Copyright Striking Backrooms Artwork Older Than the Movie

https://www.thegamer.com/the-backrooms-a24-copyright-strike-artwork/
1•josephcsible•38s ago•0 comments

Show HN: I ported Fallout 1 to the PSP

https://github.com/abduznik/fallout1-ce-psp
1•abduznik•44s ago•0 comments

Making TLA+ and x86 Kiss via Z3Py

https://www.philipzucker.com/kissin_tla/
1•matt_d•52s ago•0 comments

It Is Not the Critic Who Counts (1910)

https://www.trcp.org/2011/01/18/it-is-not-the-critic-who-counts/
1•Eridanus2•1m ago•0 comments

Mullin Threatens 'Prison Time' for State Officials Not Cooperating on Elections

https://www.mediaite.com/media/news/just-in-mullin-threatens-prison-time-for-state-officials-not-...
1•rawgabbit•1m ago•0 comments

How to Write Unmaintainable Code (2015)

https://github.com/droogans/unmaintainable-code
1•theanonymousone•2m ago•0 comments

Bridgetown: Next-Generation Progressive Site Generator

https://www.bridgetownrb.com/
1•thunderbong•2m ago•0 comments

Ask HN: Is AI sycophancy a way to reduce compute rather than make users happier?

1•amichail•3m ago•0 comments

The Zilog Z80 has turned 50

https://goliath32.com/blog/z80.html
1•st_goliath•3m ago•0 comments

Perldelta – what is new for Perl v5.44.0

https://metacpan.org/dist/perl/view/pod/perldelta.pod
1•birdculture•3m ago•0 comments

Show HN: Tools Berry – client-side calculators with open-source tax engines

https://tools-berry.com/
1•edmonddaher•6m ago•1 comments

The Java Story – The Official Documentary [video]

https://www.youtube.com/watch?v=ZqGSg4b_cZA
2•mashally•7m ago•0 comments

Ann Droid

https://en.wikipedia.org/wiki/Ann_Droid
1•Fizzadar•8m ago•0 comments

GNUnet 0.28.0 Released

https://www.gnunet.org/en/news/2026-07-0.28.0.html
1•summm•8m ago•0 comments

Wearable foundation models: a brief history

https://www.empirical.health/blog/wearable-foundation-models/
1•brandonb•9m ago•0 comments

EU set to axe 2039 net-zero industry target

https://www.euractiv.com/news/brussels-set-to-axe-2039-net-zero-industry-target/
1•alephnerd•10m ago•0 comments

Brown Professor Suspects Majority of His Class Used AI to Cheat

https://www.insidehighered.com/news/faculty/learning-assessment/2026/07/08/brown-professor-suspec...
1•bushwart•10m ago•0 comments

Meta trying to destroy whistleblower Sarah Wynn-Williams, US senator says

https://www.theguardian.com/technology/2026/jul/17/meta-whistleblower-sarah-wynn-williams-us-sena...
3•barbazoo•13m ago•0 comments

New spinning drone hides in plain sight

https://news.northwestern.edu/stories/2026/07/new-spinning-drone-hides-in-plain-sight
1•gmays•13m ago•1 comments

Dustin Mierau's Desktop Homepage

https://dustin.works/
1•colinprince•13m ago•0 comments

Show HN: Stickblade Arena – I made two LLMs sword-fight to benchmark them

https://stickblade-arena.vercel.app
1•pioneer37•18m ago•0 comments

FDA Approves a New Pill to Slash Cholesterol Levels

https://www.nytimes.com/2026/07/16/science/the-fda-approves-a-new-pill-to-slash-cholesterol-level...
2•gmays•18m ago•0 comments

Apple raises prices for Apple Music and Apple One subscriptions

https://9to5mac.com/2026/07/17/apple-raises-prices-for-apple-music-and-apple-one-subscriptions/
1•elffjs•23m ago•0 comments

BYD aims to overtake Toyota in five years without relying on the US market

https://carnewschina.com/2026/07/15/byd-aims-to-overtake-toyota-in-five-years-without-relying-on-...
1•awad•27m ago•1 comments

What Is China's Moonshot AI and Why Is It Roiling Markets?

https://www.bloomberg.com/news/articles/2026-07-17/what-is-moonshot-ai-why-china-s-new-model-is-r...
1•technewssss•27m ago•0 comments

Randomverse – A randomized, algorithm-free social network

https://randomverse-social.vercel.app
1•MohammedBokir•27m ago•0 comments

Show HN: Run Hermes Agent with Kimi 3 in a sandbox

1•oryx1729•31m ago•1 comments

Why the People Who Could Fix It Are the First to Leave

https://www.hackingleadership.com/p/why-the-people-who-could-fix-it-are-the-first-to-leave
15•backlit4034•33m ago•4 comments

Portents of Doom

https://blog.dshr.org/2026/07/portents-of-doom.html
1•FabHK•33m ago•0 comments

WTH is up with Network School?

https://sextechandmergers.blogspot.com/2026/07/wth-is-up-with-network-school.html
1•jerng•34m ago•1 comments