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

Nature's many attempts to evolve a Nostr

https://newsletter.squishy.computer/p/natures-many-attempts-to-evolve-a
1•birdculture•1m ago•0 comments

Show HN: Made a quick tool to test controller stick sensitivities and curves

https://gamepadtuner.com
1•ridwanc•2m ago•0 comments

Database Anonymiser

https://github.com/mnnayeck/db-anonymiser
1•nmnayeck•2m ago•1 comments

Ask HN: ArXiv Endorsement as Independent Researcher

1•7777777phil•4m ago•0 comments

CodeClash

https://codeclash.ai/
1•falcor84•6m ago•0 comments

Show HN: LogDeck – Container management and logs viewer for self-hosters

https://github.com/AmoabaKelvin/logdeck
1•KelvinAmoaba•8m ago•0 comments

How to Identify AI-Written Web Fiction

https://recordcrash.substack.com/p/how-to-identify-ai-written-web-fiction
1•networked•9m ago•0 comments

What happens when the coding becomes the least interesting part of the work

https://obie.medium.com/what-happens-when-the-coding-becomes-the-least-interesting-part-of-the-wo...
2•avivby•10m ago•0 comments

How to Launch on Hacker News (2012) [video]

https://www.youtube.com/watch?v=KjbQU6LmZzQ
1•ensocode•14m ago•0 comments

Is it just me or is fedora becoming mainstream

https://old.reddit.com/r/Fedora/comments/1pkk5k8/is_it_just_me_or_is_fedora_becoming_mainstream/
2•sipofwater•18m ago•0 comments

Programmer Network Platform

https://programmer.network
1•agjs•19m ago•0 comments

Installing Every NixOS Package

https://unnamed.website/posts/installing-every-nixos-package/
1•OuterVale•23m ago•0 comments

Ask HN: What is Fullstack Engineering?

1•grandimam•26m ago•0 comments

Algorithms do widen the divide: Social media feeds shape political polarization

https://english.elpais.com/technology/2025-11-27/algorithms-do-widen-the-divide-social-media-feed...
2•PaulHoule•27m ago•0 comments

Atlassian Security Bulletin – December 11 2025

https://confluence.atlassian.com/security/security-bulletin-december-11-2025-1689616574.html
1•gjvc•29m ago•0 comments

Southeast Asia seeks its place in space

https://www.technologyreview.com/2025/12/12/1129235/dispatch-thai-space-expo-southeast-asia-explo...
1•fleahunter•31m ago•0 comments

Gitlantis: Drive a boat through your codebase in 3D

https://marketplace.visualstudio.com/items?itemName=brian-njogu.gitlantis
1•summarity•33m ago•0 comments

Tricking a Security AI agent into pwning itself

https://www.hacktivesecurity.com/blog/2025/12/10/cve-2025-67511-tricking-a-security-ai-agent-into...
1•edoardottt•36m ago•0 comments

Ask your LLM for receipts: What I learned teaching Claude C++ crash triage

http://addxorrol.blogspot.com/2025/12/ask-your-llm-for-receipts-what-i.html
1•tdullien•38m ago•0 comments

Adopt Unicode Characters

https://aac.unicode.org/adopt
1•selvan•39m ago•0 comments

US threatens new ICC sanctions unless court pledges not to prosecute Trump

https://www.reuters.com/world/us/us-threatens-new-icc-sanctions-unless-court-pledges-not-prosecut...
10•jeroenhd•40m ago•0 comments

The most performant, secure, scalable, reliable, freest data platform

https://averagedatabase.com
1•tamnd•41m ago•0 comments

Simplify GPU Programming with Nvidia CUDA Tile in Python – Nvidia Technical Blog

https://developer.nvidia.com/blog/simplify-gpu-programming-with-nvidia-cuda-tile-in-python/
2•rbanffy•43m ago•0 comments

Hogwarts Legacy is free on the Epic Games Store for a limited time

https://www.windowscentral.com/gaming/hogwarts-legacy-epic-games-store-freebie-the-game-awards-20...
1•cyrc•44m ago•0 comments

Explaining Christmas to developers as a system architecture story

1•frafdez•51m ago•0 comments

Show HN: Workmux – Parallel development in tmux with Git worktrees

https://github.com/raine/workmux
2•rane•52m ago•0 comments

Native ads coming soon to Stack Overflow and Stack Exchange

https://meta.stackexchange.com/questions/415259/native-ads-coming-soon-to-stack-overflow-and-stac...
6•exploraz•53m ago•7 comments

How does a "you interview for US company, we do the work" scam work?

8•marttilaine•1h ago•8 comments

Show HN: AI Advent Calendar – 25 practical AI tips for small business owners

https://advent.abasis.ai
2•akimov_pro•1h ago•0 comments

We're launching Bindu, a simple way to connect AI agents

https://github.com/GetBindu/Bindu
1•ai_biden•1h ago•6 comments