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?

Show HN: Baloo, self-hosted AI code review for GitHub

https://github.com/bluebear-io/baloo-bear
1•amirshk80•1m ago•0 comments

In the wake of closure, a digital archive of animated materials appears online

https://filmstories.co.uk/news/tippett-studios-in-the-wake-of-its-closure-a-digital-archive-of-an...
1•rdmuser•1m ago•0 comments

Show HN: I open-sourced the gradient picker from our design editor

https://github.com/rishimohan/colorshot
1•zinx•1m ago•0 comments

Lawmakers look to require AM radio in new cars despite automakers' pushback

https://chicago.suntimes.com/media/2026/10/03/lawmakers-am-radio-new-cars-automakers-pushback
1•TMWNN•3m ago•0 comments

Scoop: White House monitors suspected plague outbreak in Russia

https://www.axios.com/2026/10/04/russia-plague-outbreak-white-house-us
1•colinhb•4m ago•0 comments

Annotated Finnegans Wake

https://finwake.com/01/01.htm
1•gregsadetsky•5m ago•0 comments

Fallstreak Hole

https://en.wikipedia.org/wiki/Fallstreak_hole
1•the-mitr•6m ago•0 comments

Show HN: MapLibre Compose, Interactive Vector Maps for Compose Multiplatform

https://github.com/maplibre/maplibre-compose
1•sargunv•7m ago•0 comments

Repair Café Silicon Valley

https://repaircafesv.org/
1•akman•8m ago•0 comments

blob camera

https://twitter.com/yaosamo/status/2104099908915753331
1•yaosamo•8m ago•0 comments

What new cat ownership data says about Americans

https://www.washingtonpost.com/opinions/interactive/2026/10/04/what-new-cat-ownership-data-says-a...
1•pseudolus•9m ago•1 comments

Recly – turn your watch into a Plaud-style AI recorder

https://recly.dev/
1•rokrokss•10m ago•0 comments

Gold Steadies as Softer Inflation Cuts Fed Hike Bets

https://coinmarketcap.com/community/post/379792617/
1•joeymabia1•11m ago•0 comments

Full-fabric VHDL LLM inference engine. Runs Qwen3.5-class transformer inference

https://github.com/Nero7991/llm.vhdl
1•jacquesm•14m ago•0 comments

The Unspoken Arithmetic of the Alto Line

https://melvynschobel.substack.com/p/the-unspoken-arithmetic-of-the-alto
1•dorygold•17m ago•0 comments

Let's compete with China on AI social impact

https://www.machinesociety.ai/p/lets-compete-with-china-on-ai-social
1•mikelgan•17m ago•0 comments

Linear Exponential Scaling in Non-Abelian Groups: A Universal Map

https://zenodo.org/records/23138998
1•GeometryKernel•19m ago•0 comments

Iran is going after America's debt it's targeting the $40T America owes

https://jaymartin.substack.com/p/iran-is-going-after-americas-debt
3•robaato•20m ago•0 comments

We Built an Independent DNS Cache Edge

https://blog.dnsimple.com/2026/08/building-our-fully-independent-dns-edge/
1•unixfg•23m ago•0 comments

Google freezes open-source bug bounty program amid flood of invalid AI slop

https://www.tomshardware.com/tech-industry/artificial-intelligence/google-suspends-part-of-the-os...
5•rdmuser•24m ago•0 comments

How many humans does it take to make tech seem human?

https://blog.computationalcomplexity.org/2026/10/how-many-humans-does-it-take-to-make.html
2•ilreb•27m ago•0 comments

Show HN: Mathness – printable math worksheets, pre-K to grade 5

https://mathness.app/
1•zubink•27m ago•0 comments

Live vote counting for Brazilian Presidential elections

https://resultados.tse.jus.br/oficial/app/index.html#/eleicao/6257/uf/br/cargo/1/vis/nominal/resu...
3•frozenlettuce•32m ago•1 comments

Your Right to Privacy Doesn't Disappear When You're in Public

https://reason.com/2026/09/30/your-right-to-privacy-doesnt-disappear-when-youre-in-public/
3•iamnothere•33m ago•0 comments

AI is making ambition feel pointless [video]

https://www.youtube.com/watch?v=nc8UBme3XLQ
3•dumindunuwan•34m ago•1 comments

Asteroid-mining company to launch first autonomous space mission in 2027

https://www.space.com/technology/without-a-single-command-from-the-ground-asteroid-mining-company...
1•simonebrunozzi•38m ago•0 comments

Mellon Foundation Releases the First National Study of Community-Based Archives

https://www.mellon.org/news/mellon-foundation-releases-the-first-national-study-of-community-base...
1•rdmuser•40m ago•0 comments

Memelang: Token-Terse Query Language

https://memelang.net/11/
1•bri-holt•41m ago•0 comments

Remote-Jobs-Api.tten.no

https://remote-jobs-api.tten.no
1•earnnovadev•42m ago•0 comments

Show HN: Web Analytics Focused on Revenue

https://revscope.co/demo/
1•slashdev•42m ago•0 comments