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

Lessons learned from rebuilding a 19-year-old platform in one week with Claude

https://gist.github.com/janit/6559e97ceb00e444b9aecb3c00dfdf16
1•velmu•1m ago•0 comments

Show HN: CoThou v0.2 – Autonomous Superagent

https://cothou.com/
1•MartyD•5m ago•0 comments

DHS demands Google, Reddit, Meta, Discord provide data of users criticizing ICE

https://www.reddit.com/r/politics/s/DR5OaH9CV1
1•wahnfrieden•6m ago•1 comments

I am not joining OpenAI

1•Johnyjohnson123•7m ago•0 comments

Physicist: After 33 billon years, universe 'will end in a big crunch'

https://news.cornell.edu/stories/2025/10/physicist-after-33-billon-years-universe-will-end-big-cr...
1•danny00•7m ago•0 comments

Local AI Assistant for Linux That Runs Commands

https://github.com/zkzkGamal/zkzkAgent
1•Zakaria_Gamal•10m ago•0 comments

Show HN: OpenSustain.Analytics

https://opensustain-analytics.streamlit.app/
1•protontypes•11m ago•0 comments

Show HN: Speed Reader – Chrome extension for RSVP speed reading

https://chromewebstore.google.com/detail/speed-reader/iifbkjcdekfokhpjbiabfgjlloabpdlp
1•GlebShalimov•11m ago•0 comments

Olympic Curling - Super Smash Curling

https://github.com/newell-paul/super-smash-curling
1•paul_n3•15m ago•2 comments

Yates v. United States (2015)

https://en.wikipedia.org/wiki/Yates_v._United_States_(2015)
1•greyface-•16m ago•0 comments

Building Technical Cathedrals for an Audience That No Longer Visits Webs

https://en.andros.dev/blog/58441321/building-technical-cathedrals-for-an-audience-that-no-longer-...
1•andros•16m ago•0 comments

Unitree's Kung Fu Robot Demostration During the Chinese New Year Gala [video]

https://www.youtube.com/watch?v=R40IDdAkRZM
2•zaikunzhang•21m ago•0 comments

Show HN: I made an affiliate site that tracks sales with coupons, not cookies

https://refwaffle.com
1•jakemanger•21m ago•0 comments

Defensive Publication: A $0 Alternative to Patents for Bootstrapped SaaS

1•patentailab•25m ago•1 comments

Programming is no longer the main skill of SWE

https://edwardbx.com/articles/programming-skill/
1•crassus_ed•28m ago•0 comments

Share your core values with Claude Codd every time

https://github.com/albertnahas/claude-core-values
1•albertnahas•35m ago•1 comments

HN is an echo chamber of AI wrappers. Moving to Slashdot

4•mekod•42m ago•2 comments

AI is destroying open source, and it's not even good yet

https://www.youtube.com/watch?v=bZJ7A1QoUEI
1•liberostelios•43m ago•0 comments

Show HN: Toice – Local voice typing for Linux using Whisper

https://github.com/harshsharma2455/Toice
1•zherotz•45m ago•0 comments

Show HN: Game Engine in Julia with 400KB Exports (Vs Unity's 200MB)

https://github.com/sinisterMage/Open-Reality
3•MrNova•47m ago•2 comments

A passionate defense of the M Pro series of chips

https://birchtree.me/blog/a-passionate-defense-of-the-m-pro-series-of-chips/
3•ingve•48m ago•0 comments

Why AI writing is so generic, boring, and dangerous: Semantic ablation

https://www.theregister.com/2026/02/16/semantic_ablation_ai_writing/
2•KnuthIsGod•49m ago•0 comments

Site Runs on 30GB of RAM

https://nebezb.com/30gb-ram/
3•nebezb•52m ago•1 comments

Password managers less secure than promised

https://ethz.ch/en/news-and-events/eth-news/news/2026/02/password-managers-less-secure-than-promi...
1•sschueller•54m ago•0 comments

Prototyping UIs has always been a good fit for vibe coding

https://twitter.com/geoffreylitt/status/2023589705246200289
1•tosh•54m ago•0 comments

Apax pulls out of Pinewood Technologies takeover after AI scare

https://www.thetimes.com/business/companies-markets/article/apax-pinewood-technologies-bid-ai-fqq...
1•petethomas•55m ago•0 comments

Rust-CAS

https://github.com/ibkvictor/Rust-CAS
1•ibk_victor•57m ago•0 comments

Product Lock – A JSON spec that defines what your AI-built product is and isn't

https://github.com/nickjazz/product-lock
1•nickjazz1998•57m ago•0 comments

Bacterial strain from 5k-year-old cave ice has resistance against antibiotics

https://phys.org/news/2026-02-bacterial-strain-year-cave-ice.html
2•janandonly•58m ago•1 comments

Show HN: Free SEO Crawler and Analyze App

https://seodisias.com
1•aligundogdu•59m ago•0 comments