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

TweetStyler – I built a tool to fix the X font problem

https://www.tweetstyler.com/
1•Rashka7•1m ago•1 comments

Touchscreen MacBook Pro OLED is coming with a 'new interface'

https://www.tomsguide.com/computing/macbooks/the-touchscreen-macbook-pro-oled-is-coming-with-a-ne...
1•walterbell•1m ago•0 comments

Esoteric EBB is an isometric, Disco-like, TTRPG-turned-CRPG with deep dialogs

https://esotericebb.com
1•doener•1m ago•0 comments

CRusTTY: A pedagogical C interpreter with time-travel debugging capabilities

https://github.com/aicheye/crustty
1•varun_ch•1m ago•0 comments

SigilJS – Runtime Types for JavaScript

https://github.com/antistructured/sigiljs
1•antistructured•2m ago•1 comments

The Vibe to Production Pipeline

https://bandarra.me/posts/vibe-to-production
1•andreban•4m ago•0 comments

The Evolution of Lego Sorting (2001)

https://news.lugnet.com/storage/?n=707
1•fifilura•4m ago•0 comments

Rails Testing on Autopilot: Building an Agent That Writes What Developers Won't

https://mistral.ai/news/rails-testing-on-autopilot-building-an-agent-that-writes-what-developers-...
1•pember•5m ago•0 comments

Distributed Python dataframes and machine learning with Livebook and Elixir

https://dashbit.co/blog/distributed-python-livebook
1•tosh•5m ago•0 comments

I emailed 70 consulting partners. No replies. What it taught me

https://willem720055.substack.com/p/i-emailed-70-consulting-partners
2•anqer•6m ago•1 comments

Hotpatching goes default in Windows Autopatch whether you like it or not

https://www.theregister.com/2026/03/11/microsoft_hotpatching/
3•Bender•7m ago•0 comments

ICO fines Police Scotland over data-sharing debacle in gross misconduct case

https://www.theregister.com/2026/03/11/ico_fines_police_scotland_over/
3•Bender•8m ago•0 comments

Autopen

https://en.wikipedia.org/wiki/Autopen
1•thunderbong•8m ago•0 comments

Idempotent Slices with Applications to Code-Size Reduction

https://arxiv.org/abs/2603.09726
1•matt_d•10m ago•0 comments

A Message to Our Customers

https://www.stryker.com/us/en/about/news/2026/a-message-to-our-customers-03-2026.html
3•LostMyLogin•11m ago•0 comments

Binance sues WSJ, panicked by gov't probes into sanctioned crypto transfers

https://arstechnica.com/tech-policy/2026/03/binance-sues-wsj-over-report-sparking-government-prob...
5•xoa•12m ago•0 comments

Is launching a product on here a thing

3•charliewehan10•13m ago•2 comments

Iran tells world to get ready for oil at $200 a barrel

https://www.reuters.com/world/middle-east/combatants-mideast-war-trade-more-air-strikes-iran-clam...
4•geox•14m ago•2 comments

Apple Studio Displays have 128 GB of storage

https://www.macrumors.com/2026/03/11/studio-display-internal-storage-128gb/
3•dabinat•14m ago•0 comments

Designing AI agents to resist prompt injection

https://openai.com/index/designing-agents-to-resist-prompt-injection
1•surprisetalk•14m ago•0 comments

Code reviews do find bugs

https://entropicthoughts.com/code-reviews-do-find-bugs
2•fanf2•17m ago•0 comments

Anthropic GAAP revenue only $5B -not $19B

https://www.reuters.com/commentary/breakingviews/anthropic-gives-lesson-ai-revenue-hallucination-...
2•GorbachevyChase•17m ago•0 comments

The Anthropocentric Blind Spot

https://langmodelle.substack.com/p/the-anthropocentric-blind-spot
2•datanality•19m ago•0 comments

Show HN: Hyper – A stupidly non-corporate voice AI app for IRL conversations

https://apps.apple.com/us/app/hyper-ai-for-real-talk/id6760206718
7•shainvs•20m ago•1 comments

//go:fix inline and the source-level inliner

https://go.dev/blog/inliner
2•commotionfever•20m ago•0 comments

Rust is slowly but surely eating PostgreSQL: Deep dive into Neon, and more

https://kerkour.com/rust-eating-postgres
3•amatheus•20m ago•0 comments

Industry reports point to potential farm waste energy boom amid federal scrutiny

https://www.thenewlede.org/2026/02/biogas-rng-farm-digester-potential/
1•PaulHoule•20m ago•0 comments

Guess I was wrong about Kubernetes. Blame geopolitics

https://www.robinosborne.co.uk/2026/03/10/guess-i-was-wrong-about-kubernetes-blame-geopolitics/
2•donutshop•20m ago•0 comments

OpenRCA benchmark – Improving Claude's root cause analysis accuracy by 12 pp

https://relvy.ai/blog/relvy-improves-claude-accuracy-by-12pp-openrca-benchmark
5•behat•20m ago•0 comments

Show HN: Social Media, Reset

3•novateg•21m ago•0 comments