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?

Lists of Problems

https://en.wikipedia.org/wiki/Lists_of_problems
1•num42•3m ago•0 comments

Clean up your Android TV

https://tv.cobanov.dev/
1•chris_overseas•4m ago•0 comments

Decapitating a MacBook

https://mm-dev.rocks/series/decapitating-macbook-an-odyssey/
1•luu•6m ago•0 comments

Care for a Little More AI?

https://proofsandprompts.com/2026/08/30/care-for-a-little-more-ai/
1•throwaway81523•7m ago•0 comments

WeatherNext 3: Hourly global weather forecasts using live satellite data

https://blog.google/innovation-and-ai/models-and-research/google-deepmind/introducing-weathernext-3/
1•fourfire•10m ago•0 comments

Thank you for being part of the GitHub Classroom journey

https://github.com/orgs/community/discussions/205975
1•qainsights•12m ago•0 comments

Show HN: Octoweb – a free, open-source keyboard-first browser for macOS

https://octoweb.xyz/
1•donk8r•14m ago•0 comments

VS Code – Official Documentary [video]

https://www.youtube.com/watch?v=kHL3XzjpT5w
2•MehrdadKhnzd•18m ago•0 comments

I Want More AI at Dartmouth

https://www.theatlantic.com/ideas/2026/09/universities-prohibiting-ai-classroom/688509/
1•paulpauper•19m ago•0 comments

The Dark Side of Mindfulness

https://www.theatlantic.com/ideas/2026/09/meditation-willoughby-britton-downsides/688474/
2•paulpauper•20m ago•0 comments

Teaching robots mortal kombat moves [video]

https://www.youtube.com/watch?v=1Oo8h655VMM
2•anton5mith2•20m ago•0 comments

The state of AI in 2026: On the road to ROI

https://www.mckinsey.com/capabilities/quantumblack/our-insights/the-state-of-ai?cid=mgp_opr-eml-n...
1•giuliomagnifico•22m ago•0 comments

Judge blocks X rival from using Twitter name, but allows 'Tweet' for now

https://techcrunch.com/2026/09/04/judge-blocks-x-rival-from-using-twitter-name-but-allows-tweet-f...
2•rdmuser•26m ago•0 comments

Is your favorite plant-based milk good for the planet

https://www.nationalgeographic.com/magazine/article/how-your-favorite-plant-based-milk-alternativ...
2•teleforce•32m ago•1 comments

Seismic Isolation

https://www.ligo.caltech.edu/page/vibration-isolation
1•pillars•33m ago•0 comments

34 arrests made for drug trafficking at Burning Man as of Friday

https://www.rgj.com/story/life/arts/burning-man/2026/09/04/34-arrested-drug-trafficking-burning-m...
1•MilnerRoute•35m ago•0 comments

Vancouver strip club's Instagram taken down over sign featuring lake joke

https://www.vancouverisawesome.com/local-news/vancouver-strip-club-instagram-taken-down-sign-call...
11•anigbrowl•38m ago•4 comments

Datacenters Are the New Shale Oil

https://pracap.com/datacenters-are-the-new-shale-oil/
3•Ambolia•44m ago•0 comments

Show HN: Generate safe WebMCP tools from your OpenAPI spec or validation schemas

https://github.com/SouravInsights/webmcp-stack
1•SouravInsights•46m ago•0 comments

Show HN: Main Street Toolbox – Calculators for small business owners

https://mainstreettoolbox.com/
1•devinjin•48m ago•0 comments

LLM-as-a-Verifier

https://github.com/llm-as-a-verifier/llm-as-a-verifier
2•simonpure•53m ago•0 comments

Show HN: 4D Chess

https://4dchess.org/
1•nadermx•53m ago•0 comments

The Shape and Feel of the Post-AI Data Stack

https://www.iandmacomber.com/blog/post-ai-data-stack/
1•nlpnerd•57m ago•1 comments

B.C. man lost for 5 nights in mountains near Squamish shares survival story

https://www.cbc.ca/lite/story/9.7333975
1•colinprince•59m ago•0 comments

Trump signs order to remove endangered species protection for grey wolves

https://www.bbc.com/news/articles/c62k677d4lzo
20•Alien1Being•59m ago•3 comments

Show HN: Deterministic Synthetic Fingerprints from a Seed

https://github.com/1etu/actual-fingerprints
1•1etu•1h ago•0 comments

Surfing the Purple Ocean

https://architectureintel.com/surfing-the-purple-ocean-97907b95f3bb?postPublishedType=initial
1•younss•1h ago•0 comments

Seaside, Florida

https://en.wikipedia.org/wiki/Seaside,_Florida
1•hyperific•1h ago•0 comments

BLLM / ALLM – before and after LLM

1•orian•1h ago•0 comments

VMware Intros Private AI Cloud

https://www.nextplatform.com/cloud/2026/09/01/vmware-intros-private-ai-cloud-ai-factory-as-worklo...
1•jonbaer•1h ago•1 comments