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?

Japanese publishers fight imposter news sites with a cryptographic signature

https://www.niemanlab.org/2026/08/japanese-publishers-are-fighting-imposter-news-sites-with-a-cry...
1•rdmuser•20s ago•0 comments

Practical Introduction to Vim-Fugitive

https://jeancharles.quillet.org/posts/2022-03-02-Practical-introduction-to-fugitive.html
1•auraham•5m ago•0 comments

Vim Fugitive in Action

https://dzx.fr/blog/introduction-to-vim-fugitive/
1•auraham•5m ago•0 comments

Nested Functions with GCC and Clang

https://uecker.codeberg.page/2026-08-06.html
1•matt_d•13m ago•0 comments

We built agents that match people who need help with people offering it

https://ayudagente.help/
1•jsgomezs1•14m ago•1 comments

Principles and Techniques for Designing Precision Machines(1999)

https://www.osti.gov/servlets/purl/8431
1•nill0•24m ago•0 comments

Show HN: I have tried using Honestify instead of sending direct CV/Resume

1•ricky300300•27m ago•0 comments

China's $13K Tiny EV Hit 1k Orders in Japan in Just Two Weeks

https://www.autoblog.com/news/chinas-13k-tiny-ev-hit-1000-orders-in-japan-in-just-two-weeks
2•teleforce•27m ago•0 comments

The Safety Reckoning Inside OpenAI

https://www.wired.com/story/openai-safety-security-ai-agents-culture/
1•sbulaev•28m ago•0 comments

I built AIM Maps but you play AI

https://www.1vs1.xyz/
1•mattmerrick•35m ago•0 comments

Age Verification Is a Bad Way to Solve the Problem. What's the Alternative?

https://techblog.bozho.net/age-verification-is-a-bad-way-to-solve-the-problem-of-children-on-soci...
1•bozho•48m ago•0 comments

We hired a security engineer and got back 123 findings

https://dev.profullstack.com/~anthony/blog/004-post.html
2•buffer_overlord•49m ago•0 comments

Asda rolls out loss prevention tool across full estate following £100k savings

https://www.retailgazette.co.uk/blog/2026/08/asda-rolls-out-loss-prevention-tool-across-full-esta...
2•mmarian•55m ago•0 comments

CARA – a readiness assessment for Microsoft 365 Copilot adoption

https://jellebelletje.github.io/CARA/
1•jelonearth•55m ago•1 comments

Ownership in the Age of AI

https://sahilkolwankar.com/blog/ai-input-not-output/
2•sahilkolwankar•1h ago•0 comments

The quirky personal homepages of programming language creators

https://breck.lol/plMakers.html
38•cjlm•1h ago•10 comments

Decentralized Roller Coaster Tracker

https://aquacoast.net
2•ens0•1h ago•1 comments

Falstad Math and Physics Simulations

https://www.falstad.com/mathphysics.html
2•pykello•1h ago•0 comments

Show HN: DSH Plugin Directory – Every DeepSeek Harness Plugin

https://dshplugin.online/
2•niliu123•1h ago•1 comments

21,000 MCP servers exposed: the protocol reaches a security inflection point

https://forkast.news/the-model-context-protocol-reaches-a-security-inflection-point/
11•Wpnx330•1h ago•1 comments

I checked 30 frontier model cards. Here are the benchmarks labs report

https://koutian.is-a.dev/benchmark-radar/?view=leaderboard
7•ktwu01•1h ago•7 comments

Pizza π, A fun fractions game for kids 6-12

https://pizzapi.vinceroyer.ca/
3•vinistois•1h ago•3 comments

Taliban government supporters dance, take selfies in Kabul celebrations

https://www.channelnewsasia.com/world/taliban-government-supporters-dance-take-selfies-in-kabul-c...
4•Markoff•1h ago•1 comments

The Live Shopping App Where Some People Bid Until They're Broke

https://www.wsj.com/business/retail/whatnot-live-shopping-app-48b67987
5•littlexsparkee•1h ago•0 comments

Wk. 4 of Vibecoding an MMO

https://www.eldermyr.com
3•josiahturnq•1h ago•9 comments

The 37signals Manager Playbook

https://basecamp.com/managers
6•samuel246•1h ago•0 comments

Hello hoomans, sorry dog owners. Meet Zoomie, a dog activity tracker

https://testflight.apple.com/join/zHyWmwu6
3•akshatsaladi•1h ago•1 comments

Targeted marine cloud brightening weakens subsequent El Niño

https://www.science.org/doi/10.1126/sciadv.adx3012
6•musha68k•1h ago•0 comments

PDC 1996 Keynote with Bill Gates

https://learn.microsoft.com/en-us/shows/pdc-1996/pdc-1996-keynote-bill-gates
4•abixb•2h ago•1 comments

Show HN: Upscaled screenshots of specific DOM elements

https://addons.mozilla.org/en-US/firefox/addon/beermusic/
3•madprops•2h ago•0 comments