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•6mo 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•6mo 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•6mo 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•6mo 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•6mo ago
Load test against a clone instead of a DB whose contents you care about?

Bitcoin Treasury Companies

https://bitcointreasuries.net/
1•svenfaw•49s ago•0 comments

Scala 3 slowed us down?

https://kmaliszewski9.github.io/scala/2025/12/07/scala3-slowdown.html
1•kmaliszewski•1m ago•0 comments

The Syncthing Android drama is exploding

https://mastodon.pirateparty.be/@surfhosting/115674236291033568
1•gpi•1m ago•0 comments

Show HN: CO2W, our first web game

https://games.protulae.com?sid=shn251207
1•YoloGames•6m ago•0 comments

Authentication Explained: When to Use Basic, Bearer, OAuth2, JWT and SSO

https://javarevisited.substack.com/p/system-design-basics-authentication
1•birdculture•7m ago•0 comments

'Maintenance: Of Everything, Part One' Review: Making the Future

https://www.wsj.com/arts-culture/books/maintenance-of-everything-part-one-review-making-the-futur...
1•Brajeshwar•8m ago•0 comments

Johny Srouji informed CEO Tim Cook he is seriously considering leaving

https://twitter.com/markgurman/status/1997352821453447399
2•erex78•8m ago•1 comments

Kitchen Dispatch: A Quest to Create the Perfect Pawpaw Ice Cream

https://www.atlasobscura.com/articles/kitchen-dispatch-a-quest-to-create-the-perfect-pawpaw-ice-c...
1•quapster•8m ago•0 comments

Bodhi Linux: designed for those who value inner clarity and personal empowerment

https://www.bodhilinux.com/
1•doener•9m ago•0 comments

I Ditched Blue Iris for $0 SSH Camera Tunnels

https://joeiq.com/blog/privacy-first-home-security-camera-system/
1•joeiq•10m ago•1 comments

Q4OS: Fast and friendly, desktop oriented operating system based on Debian Linux

https://www.q4os.org/
1•doener•10m ago•0 comments

Tricki – a repository of mathematical know-how (2020)

https://www.tricki.org/
1•vismit2000•11m ago•0 comments

Privilege Escalation in Fedora Linux: Exploiting ABRT for Root

https://initblog.com/2025/abrt-root/
1•ementally•13m ago•0 comments

Mathematical "Urban Legends" (2011)

https://mathoverflow.net/questions/53122/mathematical-urban-legends
1•vismit2000•15m ago•0 comments

Three-year-old forced to serve as her own attorney in Tucson immigration court

https://coppercourier.com/2025/12/05/childrens-immigration-court/
2•sipofwater•16m ago•1 comments

Linux sysadmin interview cheating countermeasures

https://www.threads.com/@nixcraft/post/DR6kxiYjNt9
1•imglorp•16m ago•1 comments

Enterprise Agents Have a Reliability Problem

https://www.dbreunig.com/2025/12/06/the-state-of-agents.html
2•dbreunig•16m ago•0 comments

Publishing KOReader Highlights

https://tech.stonecharioteer.com/posts/2025/kollector/
4•stonecharioteer•18m ago•1 comments

Nested Learning: A new ML paradigm for continual learning

https://research.google/blog/introducing-nested-learning-a-new-ml-paradigm-for-continual-learning/
1•themgt•22m ago•0 comments

The plan-execute pattern (2024)

https://mmapped.blog/posts/29-plan-execute
1•Twixes•23m ago•0 comments

Give me AI slop over human sludge any day

https://world.hey.com/dhh/give-me-ai-slop-over-human-sludge-any-day-8c4b747d
1•vismit2000•23m ago•0 comments

Apple and Intel come closer after five years

https://www.igorslab.de/en/apple-and-intel-converge-again-after-five-years/
2•speckx•24m ago•0 comments

AntiX is a fast, lightweight and easy to install systemd-free Linux

https://antixlinux.com/
3•doener•25m ago•1 comments

Japan teen arrested for alleged ChatGPT-assisted cyberattacks

https://www3.nhk.or.jp/nhkworld/en/news/20251205_11/
1•campuscodi•28m ago•0 comments

2025 Floss/Fund Disbursements

https://floss.fund/projects/2025/
1•novoreorx•28m ago•0 comments

Show HN: Perception continuity function in multidimensional time

https://medium.com/@conversioncrossing/function-of-continuity-of-perception-in-multidimensional-t...
1•neuralquantum•29m ago•1 comments

Dollar-stores overcharge cash-strapped customers while promising low prices

https://www.theguardian.com/us-news/2025/dec/03/customers-pay-more-rising-dollar-store-costs
4•bookofjoe•32m ago•0 comments

Obfuscating Image Links

https://sigwait.org/~alex/blog/2025/12/07/qYkza8.html
1•henry_flower•33m ago•0 comments

Exploring the Gameboy Memory Bank Controller (2020)

https://b13rg.icecdn.tech/Gameboy-MBC-Analysis/
1•wicket•33m ago•0 comments

Show HN: Kelora – Turn messy logs into structured data

http://www.kelora.dev/v0.14.0/
1•dloss•37m ago•1 comments