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?

IDEsaster: A Novel Vulnerability Class in AI IDEs

https://maccarita.com/posts/idesaster/
1•deanc•1m ago•0 comments

The Wild West of Post-POSIX IO Interfaces

https://www.youtube.com/watch?v=abDWZ9D8kEE
1•todsacerdoti•3m ago•0 comments

Internet Archive is experiencing service disruptions

https://twitter.com/internetarchive/status/1997563217124663714
1•exploraz•10m ago•0 comments

Amiga Mouse Cursor: The impossible hot spot

https://heckmeck.de/blog/the-impossible-hot-spot/
1•atan2•15m ago•0 comments

Show HN: I built MyuiKits to ditch rebuilding the same components

https://www.myuikits.dev
1•Oliveship•16m ago•0 comments

The Game Industry of Poland: Report 2025 [pdf]

https://www.parp.gov.pl/storage/publications/pdf/EBOOK-GAM-WCAG_27112025.pdf
2•Vedor•19m ago•0 comments

Find the words that move you

https://maximusquotes.org/
1•chenmu•20m ago•0 comments

Six New Tips for Better Coding with Agents

https://steve-yegge.medium.com/six-new-tips-for-better-coding-with-agents-d4e9c86e42a9
1•mdemare•21m ago•0 comments

The Starmer Government Crisis

https://rodgercuddington.substack.com/p/the-starmer-government-crisis
1•freespirt•31m ago•1 comments

The biggest scammer on YouTube is YouTube [video]

https://www.youtube.com/watch?v=eiFxKRyPpD0
1•flyingkiwi44•31m ago•0 comments

An AI Brain with Only One Neuron Could Surpass Humans

https://thenextweb.com/news/how-ai-brain-with-only-one-neuron-could-surpass-humans
2•tesserato•32m ago•1 comments

Russia's Africa Corps fights in Mali, witnesses describe beheadings, rapes

https://apnews.com/article/mali-russia-africa-corps-mauritania-refugees-abuses-2935dd1b50397242a9...
1•Bondi_Blue•36m ago•0 comments

My Thoughts on Claude Opus 4.5

https://www.mckaywrigley.com/posts/opus-4.5
2•tosh•46m ago•0 comments

Compressed view of current events – video blog

https://www.thelastpaideia.com/view
1•thelastpaideia•50m ago•0 comments

Full Haskell-Like Type Class Resolution in Java

https://garciat.com/posts/java-type-classes/
2•birdculture•50m ago•0 comments

Hacking '' to track any WhatsApp or Signal User [video]

https://www.youtube.com/watch?v=HHEQVXNCrW8
1•sandebert•51m ago•0 comments

Sinterklaas Likes Playing on the Game Boy

https://brainbaking.com/post/2025/12/sinterklaas-likes-playing-on-the-game-boy/
1•jandeboevrie•57m ago•0 comments

Show HN: S3 compatible store with 1M IOPS(4K-R,p99~5ms), BYOC in 5min with rust

https://github.com/fractalbits-labs/fractalbits-main
7•fractalbits•58m ago•1 comments

Noperthedron is not Rupert (can't fit through itself) [video]

https://www.youtube.com/watch?v=eeVaUNPxXy8
1•fsckboy•59m ago•1 comments

Show HN: Ogblocks – Build Beautiful React Animations in Minutes

https://ogblocks.dev/
2•karanzkk•1h ago•0 comments

Open-source proxy that lets the Claude Code CLI run on Databricks Model Serving

2•vishalveera•1h ago•0 comments

My Working Thoughts

https://www.bramadams.dev/working-thoughts/
2•_bramses•1h ago•0 comments

Ask HN: Best tricks to make a PWA feel more native?

1•julienreszka•1h ago•2 comments

Hey Students, Considering Majoring in Sociology?

https://www.ihatesociology.com/stephen-turner
1•Tomte•1h ago•0 comments

Life, Work, Death and the Peasant

https://acoup.blog/2025/07/11/collections-life-work-death-and-the-peasant-part-i-households/
2•tmoravec•1h ago•1 comments

Super Mario Tune as a Fidget Toy

https://hackaday.com/2025/04/04/3d-print-and-play-the-super-mario-tune-as-a-fidget-toy/
1•ninju•1h ago•0 comments

FunKey is a Mac app that adds mechanical keyboard sounds to your MacBook

https://apps.apple.com/us/app/funkey-mechanical-keyboard-app/id6469420677?mt=12
1•mraduldeodhiya•1h ago•0 comments

The online index of mathematical databases

https://mathbases.org/
1•OgsyedIE•1h ago•0 comments

Think First, AI Second

https://every.to/p/think-first-ai-second
2•Garbage•1h ago•0 comments

Apple Bleeding Talent to OpenAI

https://www.macrumors.com/2025/12/05/apple-bleeding-talent-to-openai/
2•mgh2•1h ago•1 comments