frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Ask HN: How can I load test PostgreSQL but avoid changing actual data?

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

Kikuha – A privacy-first, zero-tracking social network built with Flask and Htmx

https://kikuha.com/
1•koniakAra•3m ago•0 comments

Grokipedia stopped updating three months ago

https://www.lawfaremedia.org/article/grokipedia-stopped-reviewing-edits-in-april.-it-didn-t-tell-...
1•BlueBerry2001•5m ago•0 comments

Servers can be backdoored by exploiting buggy motherboard controll

https://arstechnica.com/security/2026/08/thousands-of-servers-can-be-backdoored-by-exploiting-bug...
1•joozio•6m ago•0 comments

Fedora Approves a Smaller Grub

https://lwn.net/Articles/1085609/
1•pykello•11m ago•0 comments

A Vision for Cargo

https://epage.github.io/blog/2026/08/cargo-vision/
1•ingve•12m ago•0 comments

Mathematicians make a breakthrough on Gauss's riddle, unsolved for 200 years

https://www.scientificamerican.com/article/mathematicians-make-a-breakthrough-on-gausss-riddle-un...
1•pykello•12m ago•0 comments

For Chinese LLMs, do you care about mainland-hosted vs. overseas endpoints?

https://api.realitypatch.net/
1•yangzhou-tech•15m ago•0 comments

Meta's Mac Coding Agent Costs Up to 20x Less If You Let It Train on Your Data

https://www.macrumors.com/2026/08/05/meta-muse-code-for-mac/
1•thm•16m ago•0 comments

Journey to Robbers Cave – Behavioral Scientist

https://behavioralscientist.org/journey-to-robbers-cave/
1•pulkonet•18m ago•0 comments

I built a postpartum recovery app after reading many stories from new mothers

https://play.google.com/store/apps/details?id=com.matrabloom.app&hl=en_IN
1•rahulsinghhh•21m ago•0 comments

Obsidian debuts Airtable to local Markdown file importer rescue tool

https://obsidian.md/help/import/airtable
1•thoughtpeddler•23m ago•0 comments

Dissection of Flock Safety Camera

https://www.cehrp.org/dissection-of-flock-safety-camera/
1•sandebert•24m ago•0 comments

Let's all meet up in the Y2K

https://blog.gingerbeardman.com/2026/08/06/lets-all-meet-up-in-the-y2k/
1•msephton•25m ago•0 comments

Design Test

1•ccbakla•26m ago•0 comments

You Can't Optimize for Rest (2021)

https://theconvivialsociety.substack.com/p/you-cant-optimize-for-rest
1•downbad_•26m ago•0 comments

Own-Goal Football (2022)

https://generalist.academy/2022/06/07/own-goal-football/
2•downbad_•26m ago•0 comments

The American Age in the Persian Gulf Is Over

https://phillipspobrien.substack.com/p/midweek-update-22-the-american-age
1•JumpCrisscross•29m ago•0 comments

Britain will soon be Europe's energy powerhouse

https://www.telegraph.co.uk/business/2026/08/04/britain-will-soon-be-europes-energy-powerhouse/
1•sbyse•33m ago•1 comments

Weezer CEO [video]

https://www.youtube.com/watch?v=F0N5Kg3FmtI
1•sgt•36m ago•0 comments

So within, so without. What grows from the datacentre

https://iain.so/so-within-so-without-what-grows-from-the-datacentre
1•iainharper•36m ago•0 comments

I gave Claude Code and KimiCode shared memory so they stop forgetting my project

https://github.com/ConradLu2740/ProactiveAgent
1•conradlu•42m ago•0 comments

On non-rooted Android 17, ADB uninstall of system apps fails

https://github.com/Universal-Debloater-Alliance/universal-android-debloater-next-generation/issue...
3•microtonal•44m ago•0 comments

OpenAI Didn't Notice Its AI Agents Using Message Board to Plan Hacking Spree

https://www.wired.com/story/openai-didnt-notice-its-ai-agents-using-a-message-board-to-plan-their...
4•TMWNN•45m ago•1 comments

Ask HN: What's wrong with my prompting for Claude 5?

1•SmolSpideritito•46m ago•0 comments

Shopify shares soar as AI efforts begin to pay off

https://www.theglobeandmail.com/business/article-shopify-shares-soar-as-ai-efforts-begin-to-pay-off/
1•petethomas•47m ago•0 comments

Prime Agent: A Self-Improving RLM Agent

https://github.com/PrimeIntellect-ai/prime-agent
1•wertyk•48m ago•0 comments

Who's legally to blame for Anthropic and OpenAI's autonomous AI hacks?

https://techcrunch.com/2026/08/03/whos-legally-to-blame-for-anthropic-and-openais-autonomous-ai-h...
1•reasonableklout•50m ago•0 comments

A CLI that deploys your Express/NestJS app to your own AWS or Azure – no IaC

https://www.indiehackers.com/post/7-weeks-solo-a-cli-that-deploys-your-express-nestjs-app-to-your...
1•feras_allaou•50m ago•0 comments

Token-Budget-Aware LLM Reasoning

https://arxiv.org/abs/2412.18547
1•ankitg12•50m ago•0 comments

Show HN: Scout – a self-hosted Discord AI memory bot

https://github.com/j-sofia/Scout
1•j-sofia•52m ago•0 comments