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

Lazarus Sign

https://en.wikipedia.org/wiki/Lazarus_sign
1•signorovitch•5m ago•0 comments

Neural Text Steganography

https://massa-ai.freeboxos.fr/textego/
1•asxndu•6m ago•0 comments

Mystery medical episode left astronaut unable to speak—1 of NASA's biggest risks

https://www.livescience.com/space/space-exploration/mystery-medical-episode-that-left-astronaut-u...
1•bookofjoe•8m ago•0 comments

AI is making CEO's delusional [video]

https://www.youtube.com/watch?v=Q6nem-F8AG8
1•rossdavidh•9m ago•0 comments

Lausd joins suit against social media companies

https://laist.com/brief/news/education/los-angeles-unified-school-district-lausd/los-angeles-unif...
1•freshtake•13m ago•0 comments

Show HN: Code typing game to increase your typing speed in 10 languages

https://coderacer.dev
1•Coderacer1•15m ago•0 comments

Canadian man says U.S. border officers made him give DNA sample

https://www.cbc.ca/news/canada/windsor/us-border-dna-canadian-man-cbp-cross-larson-dingell-raskin...
1•geox•16m ago•0 comments

What to Do About Those Menu Item Icons in macOS 26 Tahoe

https://mastodon.social/@stroughtonsmith/116262411548746327
2•erickhill•17m ago•0 comments

We built a multi-agent research hub. The waitlist is a reverse-CAPTCHA

https://enlidea.com
1•LZK•19m ago•1 comments

Folk are getting dangerously attached to AI that always tells them they're right

https://www.theregister.com/2026/03/27/sycophantic_ai_risks/
12•Brajeshwar•19m ago•3 comments

The risk of AI isn't making us lazy, but making "lazy" look productive

2•acmerfight•20m ago•0 comments

I built an AI that tailors your CV to every job in seconds

1•alebarbon•21m ago•0 comments

For-Agent

https://github.com/reposwarm/reposwarm-cli/wiki/--for-agent
1•royosherove•26m ago•0 comments

Show HN: Loreline, narrative language transpiled via Haxe: C++/C#/JS/Java/Py/Lua

https://loreline.app/en/docs/technical-overview/
1•jeremyfa•26m ago•1 comments

Thousands risk of deadly complications recent exposure to measles in 11 states

https://www.dailymail.co.uk/health/article-15686151/deadly-measles-brain-swelling-virus-surge.html
1•Bender•27m ago•0 comments

Can humans have babies in space? It may be harder than expected

https://www.space.com/space-exploration/human-spaceflight/having-babies-in-space-may-be-harder-th...
3•Brajeshwar•29m ago•0 comments

Difftastic

https://difftastic.wilfred.me.uk
2•KolmogorovComp•30m ago•0 comments

Every novel that has ever been published is sitting inside ChatGPT

https://twitter.com/heynavtoor/status/2037638554374099409
2•guerrilla•31m ago•1 comments

Against the Smartphone Theory of Everything

https://www.theargumentmag.com/p/against-the-smartphone-theory-of
1•ravenical•36m ago•0 comments

New Consulting Contracts in Texas Will Muzzle Authors and Harm Students

https://bookriot.com/texas-esc-1-discriminatory-contracts/
1•mooreds•37m ago•0 comments

Microsoft tells crusty old kernel drivers to get with the Windows HCP

https://www.theregister.com/2026/03/27/microsoft_kernel_trust/
2•Bender•38m ago•1 comments

ICAO issued new power bank restriction on flight

https://www.icao.int/news/new-power-bank-restrictions-will-safeguard-international-aviation
2•phantomathkg•38m ago•0 comments

Microsoft takes up residence next to OpenAI, Oracle

https://www.theregister.com/2026/03/27/microsoft_ai_crusoe/
1•Bender•39m ago•1 comments

Sharpee Interactive Fiction and Computer Science

https://github.com/ChicagoDave/sharpee/blob/main/docs/architecture/sharpee-computer-science.md
1•ChicagoDave•39m ago•0 comments

When Fake Supplements Work

https://nautil.us/when-fake-supplements-work-1279324
1•Brajeshwar•40m ago•0 comments

Show HN: Cursorlag – add a lag trail to your cursor

https://cursorlag.velocifyer.com/
1•Velocifyer•42m ago•1 comments

The Generative AI Policy Landscape in Open Source

https://redmonk.com/kholterhoff/2026/02/26/generative-ai-policy-landscape-in-open-source/
2•mooreds•42m ago•0 comments

How Not to Interview (Interesting People)

https://om.co/2026/03/19/how-not-to-interview-interesting-people/
1•mooreds•42m ago•0 comments

You can't imitation-learn how to continual-learn

https://www.lesswrong.com/posts/9rCTjbJpZB4KzqhiQ/you-can-t-imitation-learn-how-to-continual-learn
3•supermdguy•43m ago•0 comments

Don Cheli – AI writes tests before seeing the code (TDD as iron law)

https://github.com/doncheli/don-cheli-sdd
1•doncheli•44m ago•0 comments