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?

What Would a U.S. Telecommunications Act 2.0 Look Like?

https://spectrum.ieee.org/telecommunications-act-reform
1•oldnetguy•56s ago•0 comments

Can AI ever build itself? A deeper look into autonomous AI research

https://www.nachoplanas.com/articles/rsi-stacked-s-curves
1•Bluestein•1m ago•0 comments

The Mystery of the Snowden Saga – Solved

https://backlit.neocities.org/snowden
1•airhangerf15•1m ago•0 comments

Show HN: Diogenes – Account-less MCP Gateway to 45 Gemini models and guardrails

https://diogenesgateway.com/
1•diogenes_l402•1m ago•1 comments

Consumer Appetite for Personal AI Goes Mainstream

https://spectrum.ieee.org/ai-personal-assistant-intelligent-wearables
1•oldnetguy•1m ago•0 comments

Moral Crumple Zones: Cautionary Tales in Human-Robot Interaction

https://estsjournal.org/index.php/ests/article/view/260
1•kichimi•1m ago•0 comments

Human in the Loop Is Not the Solution

https://www.joelfickson.com/human-in-the-loop-is-not-the-solution.html
1•zikani_03•2m ago•0 comments

The PHP2Shell Vulnerability Heralds Cybersecurity Hell

https://spectrum.ieee.org/ai-in-cybersecurity-php2shell-vulnerability
2•oldnetguy•2m ago•0 comments

Show HN: Warli World – a folk-art village that lives above your taskbar

https://digital-troubadour.itch.io/warli-world
1•DigitalTrubador•3m ago•0 comments

Against Supplements

https://www.worksinprogress.news/p/against-supplements
2•alihm•3m ago•0 comments

Google's Gemini 4 Carbon edges Claude Opus 5.5, claims fewest hallucinations

https://www.tomshardware.com/tech-industry/artificial-intelligence/google-reveals-new-gemini-4-ca...
1•entryleveljobsc•3m ago•0 comments

Scientists detect signals at the smallest scale ever explored

https://www.bbc.com/news/articles/c5pvgxkkv4dzo
2•maartenh•3m ago•0 comments

Anthropic's IPO Filing Warns It May Be 'Imminently' Close to RSI

https://epyhia.com/anthropic-s-ipo-filing-warns-it-may-be-imminently-close-to-recursive
2•arbuge•5m ago•0 comments

Herdr vs. T3 vs. Amp: Software Factory Test

https://techstackups.com/comparisons/herdr-vs-t3-code-vs-amp/
1•ritzaco•7m ago•0 comments

Show HN: Open-Source Searchable Job Board for HN's Hiring Threads

https://flaviaouyang.github.io/hackerjobs/hiring/
1•whoisflavia•7m ago•1 comments

The gap between MDM inventory and operational visibility

https://www.lojycal.com/operational-graph
1•Lojycal•8m ago•0 comments

Show HN: WeMD – Turn web pages and WeChat articles into clean Markdown, locally

https://github.com/stwhwing/wemd-extension
1•wemd•10m ago•0 comments

Shipping 103,802 Dots in 82 KB

https://layers.engineering/shipping-103-802-dots-in-82-kb-b4f7d3a89779
1•speckx•11m ago•0 comments

Cooking Conundrums Challenge

https://zacharykai.net/notes/cookingqna
1•surprisetalk•11m ago•0 comments

Periodical Cicadas

https://en.wikipedia.org/wiki/Periodical_cicadas
2•hmokiguess•12m ago•0 comments

The cryptography behind e-voting (and why paper ballots are still essential)

https://blog.trailofbits.com/2026/11/03/the-cryptography-behind-electronic-voting-and-why-paper-b...
2•acossta•12m ago•0 comments

Polar vortex disruption comes early

https://www.bostonglobe.com/2026/10/28/metro/polar-vortex-new-england-winter-weather/
2•chmaynard•13m ago•0 comments

Practical Preimages for 19 and 20-Step SHA-256 with Standard Padding

https://arxiv.org/abs/2611.00512
1•wslh•14m ago•0 comments

Show HN: Duckity – Abuse protection for the AI agent era

https://duckity.com/
1•nyeki•14m ago•0 comments

Component technology in an embedded system (2010)

https://www.polberger.se/components/
1•davidpolberger•14m ago•1 comments

Tip

https://vivaldi.com/blog/tips/tip-97/
2•filippoalbertin•15m ago•0 comments

Large Hadron Collider finds evidence of one-in-ten-billion particle decay

https://home.cern/lhcb-finds-evidence-of-one-in-ten-billion-particle-decay/
3•simonvreeman•16m ago•0 comments

OpenSUSE Leap 16.1

https://en.opensuse.org/Release_announcement_16.1
1•e-Minguez•18m ago•1 comments

The Story of How McDonald's First Got Its Start

https://www.smithsonianmag.com/history/story-how-mcdonalds-first-got-its-start-180960931/
1•bookofjoe•19m ago•0 comments

Anthropic warns its AI could be dangerous. So why do people want to invest?

https://www.bbc.com/audio/play/w3ct8mcy
1•tosh•19m ago•0 comments