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?

Investigating a Possible Scammer in Journalism's AI Era

https://thelocal.to/investigating-scam-journalism-ai/
1•encomiast•2m ago•0 comments

Series Resistor

1•ycombele•3m ago•0 comments

Show HN: oeis-tui – A TUI to search integer sequences in the terminal

https://github.com/hako/oeis-tui
1•wesleyhill•5m ago•0 comments

Docker Desktop 4.50: Indispensable for Daily Development

https://www.docker.com/blog/docker-desktop-4-50/
1•clarkmaxwell•6m ago•0 comments

Users brutually reject Microsoft's "Copilot for work" in Edge and Windows 11

https://www.windowslatest.com/2025/11/28/you-heard-wrong-users-brutually-reject-microsofts-copilo...
1•robtherobber•6m ago•0 comments

Why do companies lie about uptime?

https://bashify.io/i/t0fLUg
1•haar•7m ago•1 comments

Smuggled North Korean phones reveal a dark reality

https://m.economictimes.com/magazines/panache/smuggled-north-korean-phones-reveal-5-chilling-feat...
1•gscott•14m ago•0 comments

Favourite influencer hasn't got a dozen dachshund dogs. It's just AI

https://www.bbc.co.uk/news/articles/c7vm5d42r8mo
1•spzb•15m ago•0 comments

Room temperature carbon capture in graphene

https://www.nature.com/articles/s41467-025-65336-4
2•bookofjoe•16m ago•0 comments

Underground AI models promise to be hackers 'cyber pentesting waifu'

https://cyberscoop.com/malicious-llm-tools-cybercrime-wormgpt-kawaiigpt/
1•thm•17m ago•0 comments

Show HN: Traffic, funding rounds, and chai – Bangalore startup life as a game

https://xagi-labs.github.io/siliconhalli
1•sauravt•21m ago•0 comments

What to Do When Creating Your CodeQL Database Fails – and How to Report the Per

https://intrigus.org/research/2025/11/28/what-to-do-when-codeql-database-creation-fails/
1•todsacerdoti•23m ago•0 comments

Show HN: Lightweight macOS menu bar Pomodoro Timer

https://github.com/berkaycit/pomodo-timer
1•berkaycit•24m ago•0 comments

The Biggest Causes of Medical Device Recalls

https://spectrum.ieee.org/medical-device-recalls
2•quapster•24m ago•0 comments

Tell HN: Telegram App iOS Woes

1•op7•26m ago•0 comments

U.S. peace plan for Ukraine formulated months ago by Kremlin operative

https://theins.ru/en/politics/287159
2•ironyman•28m ago•0 comments

Show HN: Self-hosted RAG for docs and code (FastAPI, Docling, ChromaDB)

https://github.com/2dogsandanerd/Knowledge-Base-Self-Hosting-Kit
1•2dogsanerd•33m ago•1 comments

MasonEffect – Particle-based text morphing library (now supports Svelte)

1•fe-hyunsu•33m ago•0 comments

Taking Jaggedness Seriously

https://helentoner.substack.com/p/taking-jaggedness-seriously
1•imjacobclark•34m ago•0 comments

It Is Possible to Spend Too Much on AI

https://www.wsj.com/tech/it-really-is-possible-to-spend-too-much-on-ai-7bb68df1
2•1vuio0pswjnm7•36m ago•0 comments

The Battle over Africa's Great Untapped Resource: IP Addresses

https://www.wsj.com/business/telecom/africa-ip-addresses-china-3e543b9d
3•watchdogtimer•37m ago•0 comments

Is Linus Torvalds GitHub Account Hacked?

1•meel-hd•37m ago•2 comments

Statin-independent association between low LDL and risk of T2 diabetes

https://link.springer.com/article/10.1186/s12933-025-02964-6
1•guerby•38m ago•1 comments

(2018) How I created a database of all interesting Rush Hour configurations

https://www.michaelfogleman.com/rush/
1•xeonmc•39m ago•0 comments

Moodfx v1.0 IS LIVEAs a 19yo I think I just killed every $200/mo AI suite

https://moodfx-859986050194.us-west1.run.app/
1•Iam_Moody•41m ago•1 comments

Riding the autism bicycle to retraction town

https://nobreakthroughs.substack.com/p/riding-the-autism-bicycle-to-retraction
2•OgsyedIE•42m ago•0 comments

A brief history of NSA backdoors. (2013)

https://www.ethanheilman.com/x/12/index.html
4•fanf2•43m ago•0 comments

Soul Over AI – list of AI generated bands

https://souloverai.com/
1•starquake•44m ago•0 comments

Show HN: Slash commands to enforce collaborative AI workflows (Cursor/Claude)

https://github.com/markekvall/ai-workflow-hub
1•markekvall•44m ago•1 comments

A new look at an old dog: Bonn-Oberkassel reconsidered

https://www.sciencedirect.com/science/article/abs/pii/S0305440318300049
1•thunderbong•46m ago•0 comments