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

Show HN: TalkThrough – Screen annotation and voice capture for Linear (macOS)

https://talkthrough.app/
1•leek•2m ago•0 comments

Building a whiteboard out of glass

https://nisa.la/glass-whiteboard/
1•nkalupahana•3m ago•0 comments

Show HN: Sinew – infrastructure patterns I got tired of re-writing

https://sinew.marquis.codes
1•greatnessinabox•3m ago•0 comments

Tired of AI, people are committing to the analog lifestyle in 2026

https://www.cnn.com/2026/01/18/business/crafting-soars-ai-analog-wellness
3•andy99•5m ago•0 comments

Show HN: I built a cash flow forecasting tool because YNAB is a rearview mirror

https://bountisphere.com/blog/traditional-budgeting-fails-cash-flow-forecasting
1•jondavidhague•6m ago•0 comments

The dos and don'ts of cooking with a cast-iron skillet

https://www.ft.com/content/edc50e83-2e91-42bb-ba4e-766e2cc698bd
1•mikhael•7m ago•0 comments

I built a package manager for WordPress

1•thelovekesh•9m ago•0 comments

Rust's Culture of Semantic Precision

https://www.alilleybrinker.com/mini/rusts-culture-of-semantic-precision/
1•birdculture•12m ago•0 comments

I Tried to Be the Government. It Did Not Go Well

https://www.theatlantic.com/magazine/2026/02/individual-federal-services-replacement/685333/
1•janandonly•14m ago•0 comments

QB options for Broncos after Bo Nix injury

https://www.cbssports.com/nfl/news/broncos-qb-options-bo-nix-injury-tom-brady-cant-play-but-drew-...
1•mooreds•14m ago•0 comments

The Age of Academic Slop Is Upon Us

https://hegemon.substack.com/p/the-age-of-academic-slop-is-upon
2•twapi•14m ago•0 comments

Five Foreign Policy Trends to Watch

https://www.cfr.org/article/visualizing-2026-five-foreign-policy-trends-watch
1•mooreds•14m ago•0 comments

Claude Agent Skill for Terraform and OpenTofu

https://github.com/antonbabenko/terraform-skill
1•mooreds•15m ago•0 comments

AI is everywhere, but nowhere in recent productivity data

https://www.theregister.com/2026/01/15/forrester_ai_jobs_impact/
3•gmays•16m ago•0 comments

Copilot Studio Extension for Visual Studio Code Is Now Generally Available

https://devblogs.microsoft.com/microsoft365dev/copilot-studio-extension-for-visual-studio-code-is...
1•rbanffy•16m ago•0 comments

Benchmarking my parser generator against LLVM: I have a new target

https://modulovalue.com/blog/benchmarking-against-llvm-parser/
1•modulovalue•17m ago•0 comments

Shouting In The Data Center (2009) [video]

https://www.youtube.com/watch?v=tDacjrSCeq4
1•nice_byte•18m ago•0 comments

Show HN: Jensen – Deus Ex cyberpunk aesthetic for your dev tools

https://tomaytotomato.github.io/jensen/
1•tomaytotomato•18m ago•2 comments

Vibe Coding Safely: The Ultimate Guide to AI Dev with OpenCode and NixOS

https://grigio.org/vibe-coding-safely-the-ultimate-guide-to-ai-development-with-opencode-and-nixo...
1•grigio•23m ago•0 comments

Backseat Software

https://blog.mikeswanson.com/backseat-software/
1•ingve•23m ago•0 comments

Repair advocates name CES 2026's most anticonsumer tech

https://thenewstack.io/repair-advocates-name-ces-2026s-most-anticonsumer-tech/
1•MilnerRoute•26m ago•0 comments

Chinese Fishing Boats Form Sea Barriers

https://www.nytimes.com/interactive/2026/01/16/world/asia/china-ships-fishing-militia-blockade.html
6•Alupis•26m ago•0 comments

A new Protocol Buffers generator for Golang

https://vitess.io/blog/2021-06-03-a-new-protobuf-generator-for-go/
1•fanf2•27m ago•0 comments

European Starlink competitor Eutelsat to launch more sattelites

https://www.reuters.com/business/media-telecom/starlink-rival-eutelsat-signs-deal-with-europes-ma...
2•Flundstrom2•28m ago•0 comments

60% of Legal Searches Now End Without a Click

https://talk24.ai/blog/ai-killing-legal-search
2•atreeleaf•29m ago•0 comments

Show HN: Built my portfolio in one Claude Code session – 145 repos, AI chat

https://tasteful-vibes.pages.dev
1•bmedwar•29m ago•0 comments

OpenCuff – Safe, capability-based execution for AI coding agents

http://opencuff.ai
1•kfirg•29m ago•1 comments

Everyone Will Be a Programmer

https://www.whileforloop.com/en/blog/2026/01/18/everyone-will-be-a-programmer/
1•lukas346•30m ago•1 comments

EU readies €93B tariffs in retaliation to Trump's Greenland threat

https://www.ft.com/content/b2872a49-3d43-4a55-a483-de7b19e8e436
4•mraniki•32m ago•1 comments

Interactive game/captcha/quest for web developers

https://ramys.ru/
1•ramaska•33m ago•0 comments