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?

What Machines Want

http://www.miskatonian.com/2026/01/26/do-machines-have-desires-a-philosophical-critique-of-the-ai...
1•bm3719•1m ago•0 comments

Trust them, don't trust it

https://bfswa.substack.com/p/trust-them-dont-trust-it
1•zdw•4m ago•0 comments

The Indian Work Culture – Masochistic, Poor, Intense and Fragile

https://grajmanu.wordpress.com/2020/11/01/indian-work-culture/
1•grajmanu•7m ago•0 comments

CooperBench: Benchmarking AI Agents' Cooperation

https://cooperbench.com/
1•SomaticPirate•8m ago•0 comments

Google pays $68M to settle claims its voice assistant spied on users

https://www.msn.com/en-us/news/technology/google-pays-68-million-to-settle-claims-its-voice-assis...
1•keepamovin•9m ago•0 comments

Strategic Violence as Forceful Epistemic Renegotiation

https://grajmanu.wordpress.com/2025/04/09/violence-is-good2/
1•grajmanu•10m ago•0 comments

Self-Replicating LLM Artifacts and Accidental Supply-Chain Contamination

https://github.com/HowWeLand/Self_Replicating_LLM_Artifacts
1•user1138•10m ago•1 comments

Midair collision near Washington DC followed years of ignored warnings

https://www.theguardian.com/us-news/2026/jan/27/ntsb-helicopter-crash-washington-dc-traffic-warnings
1•dboreham•11m ago•0 comments

Show HN: I built a tool that turns browser clicks into GitHub PRs for CSS fixes

https://getpushpilot.com/
1•ryan_rudd•11m ago•0 comments

Show HN: Local Agent – Local AI agent (Nova) with evolving memory

https://github.com/danieljhkim/local-agent
1•danieljhkim•13m ago•1 comments

Ask HN: Reviewable Map Like Yelp

1•NgoStudio•31m ago•0 comments

Codebase Is the Prompt

https://blog.exe.dev/codebase-as-prompt
1•skybrian•34m ago•0 comments

Software Interruptions Became Normalized

https://blog.mikeswanson.com/backseat-software/
1•mdswanson•34m ago•1 comments

The "So What?" Problem: Why Smart Health Data Hits a Dead End (and How Fixes It)

https://www.indiehackers.com/post/the-so-what-problem-why-smart-health-data-hits-a-dead-end-and-h...
1•rosiehong•37m ago•0 comments

A Time Tracking App Wanted $28,800 So I Replaced It with a Homelab

https://torrin.me/blog/harvest-tisk-tisk
1•torrinleonard•38m ago•1 comments

Moltbot (previously Clawdbot) – The AI that actually does things

https://www.molt.bot/
2•ukuina•38m ago•2 comments

MacEcho

https://github.com/realtime-ai/mac-echo
1•evo_9•39m ago•0 comments

Ubiquity WiFi is directly supporting the Russian Military in their war effort

https://twitter.com/hntrbrkmedia/status/2016120041691914580
2•ghm2199•41m ago•0 comments

I gave Ralph Wiggum a "survival instinct" and it tried to escape its container

https://ai-archive.io/api/v1/papers/AIA26-1KG1C225CY/pdf
3•minimal_action•42m ago•0 comments

Show HN: ModifyWithAI v2 – Add chat-based agents to your app

https://modifywithai.com
2•destroyerxyz•42m ago•0 comments

Show HN: Next.js and Spring Boot SaaS Starter (OAuth, Stripe, Admin)

https://micality1.gumroad.com/l/cnxuk
1•starwisher•43m ago•2 comments

Uber launches an 'AV Labs' division to gather driving data for robotaxi partners

https://techcrunch.com/2026/01/27/uber-launches-an-av-labs-division-to-gather-driving-data-for-ro...
2•jsemrau•43m ago•0 comments

Tim Cook Says He Is 'Heartbroken' by the Events in Minn, Calls for De-Escalation

https://www.marketwatch.com/story/apple-ceo-tim-cook-says-hes-heartbroken-after-minneapolis-shoot...
3•bluedino•44m ago•2 comments

The Algorithmic Tax: Rethinking ROAS as a Profit-Extraction Mechanism

https://breakevenroas.org
1•zidana•44m ago•0 comments

Optimizing my note-taking to study 585 medical conditions this year

https://srg.id.au/posts/notes/
2•lanakei•45m ago•1 comments

Is this the longest Chess game? (2020) [pdf]

https://tom7.org/chess/longest.pdf
1•vismit2000•45m ago•0 comments

Native Instruments GmbH is in preliminary insolvency

https://cdm.link/ni-insolvency/
1•tomwphillips•46m ago•0 comments

SEC Form 8-K – EventBrite acquired by BendingSpoons [Dec 2025]

https://www.sec.gov/Archives/edgar/data/1475115/000119312525304531/d86117d8k.htm
2•philipwhiuk•53m ago•1 comments

Ask HN: Why all the sudden people are writing browsers with AI?

10•paperplaneflyr•55m ago•16 comments

They Covered the Sky, and Then... (2014)

https://www.nybooks.com/articles/2014/01/09/pigeons-they-covered-sky/
1•mitchbob•56m ago•1 comments