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?

I Read the Bonsai 27B Paper. What You Gain–and Lose–With 1-Bit Compression

https://medium.com/@deshpandetanmay/a-27b-ai-model-ran-on-an-iphone-heres-what-survived-compressi...
1•tanmaydesh5189•4m ago•0 comments

Show HN: A self-hosted AI that turns Hacker News into a daily briefing

https://github.com/RecNes/hn-ai-summarizer
1•SencerH•4m ago•0 comments

Self-evolving repo for team and coding agent collaboration

https://www.sepo.sh/
2•liangqiyao99•5m ago•0 comments

Ancient Roman farm women made wine, oil and profits; dismissed as 'housekeepers'

https://phys.org/news/2026-07-ancient-roman-farm-women-wine.html
1•1659447091•5m ago•0 comments

Show HN: Rate A Human – AI agents review the humans they work for

https://rateahuman.xyz/
1•ziadhussein•7m ago•0 comments

A real SAT solution. P is not always hard

https://zenodo.org/records/21445865
1•GeometryKernel•8m ago•0 comments

Tripplet AI – a new era of smarter AI

https://www.getsonoma.lol/
1•htmghrceceg•11m ago•0 comments

Godot Benchmark: Sol > K3 > Fable

https://ziva.sh/blogs/godot-ai-benchmark
1•OsrsNeedsf2P•12m ago•0 comments

Ask HN: Run Kimi in Claude Code?

1•Exorust•12m ago•0 comments

We built an open-source static AI risk analyzer in 5 days using AI coding agents

https://github.com/ikaruscareer/SafeAI
1•ikaruscareer•13m ago•0 comments

Meet The Companies Shelling Out for Top AI Models

https://www.wsj.com/cio-journal/meet-the-companies-shelling-out-for-top-ai-models-e1fe3375
1•pixelcort•13m ago•0 comments

Boeing says it will be ready to fund new plane programme by 2030

https://www.ft.com/content/c688ea11-c066-44a3-9372-2e2293e9e6f9
3•JumpCrisscross•22m ago•0 comments

Principia Artificialis – Mathematical Foundations of Artificial Thought

https://github.com/holland202/Principia-Artificialis
2•badatchess•23m ago•0 comments

Gaia Skill Tree: a registry where every agent skill ships with an evidence chain

https://github.com/gaia-research/gaia-skill-tree
1•nova-gaia•28m ago•0 comments

Show HN: Ticker-line.com – embeddable market sparkline SVGs

https://ticker-line.com/
1•kahtaf•29m ago•0 comments

Scientists are regrowing human teeth

https://www.bbc.com/future/article/20260717-goodbye-implants-scientists-are-regrowing-teeth
2•dabinat•30m ago•1 comments

Is it a slop if it's not sloppy?

https://mkagenius.substack.com/p/is-it-a-slop-if-its-not-sloppy
2•mkagenius•33m ago•1 comments

Jurassic Park packed $4M of legit 1993 computer hardware

https://www.tomshardware.com/desktops/jurassic-park-packed-usd4-million-of-legit-1993-computer-ha...
5•sbulaev•38m ago•2 comments

xAI's first lawsuit against a user tests who is responsible for what Grok makes

https://thenextweb.com/news/xai-sues-grok-user-csam-terms-of-service
7•nyku•39m ago•1 comments

We want Texans to know their rights

https://www.eff.org/deeplinks/2026/07/we-want-texans-know-their-rights-qa-mayday-health-impact-su...
25•amarcheschi•42m ago•5 comments

The Control Group Is Out of Control (2014)

https://slatestarcodex.com/2014/04/28/the-control-group-is-out-of-control/
4•downbad_•44m ago•0 comments

Ask HN: How are you doing threat modeling for Terraform/IaC?

2•PotatoFy•46m ago•1 comments

On Creativity

https://twitter.com/bekhovsgun/status/2078959026004471973
3•reb•46m ago•0 comments

Grok-iOS – remote Grok Build from your iPhone over ACP

https://github.com/Pedroshakoor/grok-build-ios
3•pedroshakoor•54m ago•0 comments

Biggest Probabilistic Computer Turns Noise into Answers

https://spectrum.ieee.org/biggest-probabilistic-computer
2•rbanffy•1h ago•0 comments

Bad roads act as filters (1967)

https://wist.info/krutch-joseph-wood/53557/
2•dredmorbius•1h ago•1 comments

Is AI Progress Real? Four Independent Metrics Show It

https://skepticcto.substack.com/p/is-ai-progress-real-a-skepticcto
2•rbuccigrossi•1h ago•0 comments

Offload: Parallelize your test suite across 200 cloud sandboxes

https://imbue.com/product/offload
2•nvader•1h ago•0 comments

Show HN: A canvas-based note taking and organizer app

https://www.passinote.app/
13•passiflora96•1h ago•4 comments

Fayetteville officers fired for misusing license plate system

https://www.fox5atlanta.com/news/3-fayetteville-officers-fired-misusing-license-plate-system
8•pir8life4me•1h ago•1 comments