frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

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?

Bees May Be Killing the Plants They Feed From

https://nautil.us/why-these-bees-may-be-killing-the-plants-they-feed-from-1281014
1•sohkamyung•1m ago•0 comments

Lovable's AI built a 100% accessible site – or did it?

https://axesslab.com/lovable/
1•speckx•3m ago•0 comments

Send Money Anywhere – UMA

https://www.uma.money/
1•janandonly•4m ago•0 comments

Tailwind: Suffering from Success

https://blog.sebin-nyshkim.net/posts/tailwind-suffering-from-success/
1•cyco130•5m ago•0 comments

Wearable robot boosts strength of children with spinal muscular atrophy

https://www.nature.com/articles/d41586-026-01573-x
2•sohkamyung•6m ago•0 comments

You get a worktree, everyone gets a worktree

https://slicervm.com/blog/everyone-gets-a-worktree/
1•alexellisuk•7m ago•0 comments

Google API will keys keep working after you delete them

https://www.aikido.dev/blog/google-api-keys-deletion
1•berlianta•7m ago•0 comments

OpenProse: Author Outcomes

https://github.com/openprose/prose
1•TimTheTinker•10m ago•0 comments

Ask HN: If entry-level jobs are gone, does career change become impossible?

1•seanhly•11m ago•0 comments

The Maintainers Dilemma

https://spf13.com/p/the-maintainers-dilemma/
5•spf13•12m ago•0 comments

Designing a AI Access Layer for Systems of Record

https://mev.com/blog/designing-a-ai-access-layer-for-systems-of-record-a-case-study-in-team-capac...
3•AleX_MEV•12m ago•0 comments

Valgrind-3.27.1 Is Available

2•paulf38•13m ago•0 comments

Swiss smart cities promise efficiency – at the price of your data

https://www.swissinfo.ch/eng/swiss-ai/swiss-smart-cities-promise-efficiency-at-the-price-of-your-...
1•giuliomagnifico•13m ago•0 comments

Air France and Airbus found guilty of manslaughter over 2009 plane crash

https://www.bbc.co.uk/news/articles/czd2qmdvmq6o
2•mmarian•17m ago•0 comments

Show HN: Twixt – transform one word into another in four moves

https://twixt.games/
1•jakenicolaides•17m ago•0 comments

Computing Reading List

https://timrodenbroeker.de/pages/reading-list/
1•marvinborner•17m ago•0 comments

Claude Orchestra – an org layer for your Claude Code skills/agents

https://github.com/Momo2323-ui/claude-orchestra
1•mokshmittra•18m ago•0 comments

Tesla Cybertruck driver arrested after driving into lake to use 'wade mode'

https://www.bbc.co.uk/news/articles/c072x1kml44o
2•LaSombra•21m ago•0 comments

Apalache: Symbolic model checker for TLA+ and Quint

https://github.com/apalache-mc/apalache/
1•stevefan1999•21m ago•0 comments

PhD student finds lost city in Mexico jungle by accident (2024)

https://www.bbc.com/news/articles/crmznzkly3go
1•thunderbong•21m ago•0 comments

European Parliament plenary debate on 'Stop Destroying Videogames' [video]

https://www.europarl.europa.eu/plenary/en/vod.html?mode=chapter&vodLanguage=EN&internalEPId=20170...
1•michalhosna•22m ago•0 comments

Schooling Has a Meaning Crisis

https://saigaddam.medium.com/schooling-has-a-meaning-crisis-4313decd5da8
3•ChaitanyaSai•23m ago•1 comments

Open Sourcing the European Transmission Grid Ten-Year Network Development Plan

https://github.com/open-energy-transition/open-tyndp
1•lyoncy•27m ago•0 comments

Is Huawei Too Slow on AI?

https://developer.huawei.com/consumer/en/hiai/
3•xiaoluolyg•28m ago•0 comments

FatGid: FreeBSD 14.x kernel local privilege escalation

https://fatgid.io/
2•WhyNotHugo•31m ago•0 comments

SpaceX's IPO paperwork has landed

https://www.businessinsider.com/spacex-ipo-s1-public-filing-2026-5
2•soared•31m ago•0 comments

Opal Pathtracer

https://nano-optics-opal-pathtracer.pages.dev/
2•rslice•32m ago•0 comments

India to monitor Boeing fuel-switch test tied to Air India London incident

https://www.reuters.com/world/india/india-monitor-boeing-fuel-switch-test-tied-air-india-london-i...
2•gmac•32m ago•0 comments

The Original Doom Soundtrack Is Officially in the Library of Congress

https://www.engadget.com/2173357/the-original-doom-soundtrack-is-officially-in-the-library-of-con...
2•speckx•32m ago•0 comments

"I'll buy 10 of those"–NASA science chief yearns for mass-produced satellites

https://arstechnica.com/space/2026/05/ill-buy-10-of-those-nasa-science-chief-yearns-for-mass-prod...
2•rbanffy•32m ago•1 comments