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?

As drought deepens, Yuma area embraces new technology to save water

https://www.azfamily.com/2026/04/04/drought-deepens-yuma-area-embraces-new-technology-save-water/
1•mooreds•32s ago•0 comments

Former US Air Force master sergeant pleads guilty to defrauding military by $37M

https://www.theguardian.com/us-news/2026/apr/04/air-force-master-sergeant-pleads-guilty-defraudin...
1•randycupertino•51s ago•1 comments

Why samurai are cooler than klingons

https://docseuss.medium.com/why-samurai-are-cooler-than-klingons-2b296cd0dc25
1•mooreds•53s ago•0 comments

Show HN: Self-Host Excalidraw with Collaboration and Storage

https://github.com/ZimengXiong/ExcaliDash
1•zimengx•1m ago•0 comments

X Asks Court to Dismiss Music Piracy Lawsuit After Supreme Court's Cox Ruling

https://torrentfreak.com/x-asks-court-to-dismiss-music-piracy-lawsuit-after-supreme-courts-cox-ru...
1•gslin•4m ago•0 comments

Mullenweg to Cloudflare: Keep WordPress Out of Your Mouth

https://www.searchenginejournal.com/mullenweg-to-cloudflare-keep-wordpress-out-of-your-mouth/571119/
3•ValentineC•6m ago•0 comments

Treason? Yes Apple Bows to Kremlin Removes over 190 Major Apps

https://novayagazeta.eu/articles/2026/03/31/apple-reveals-it-bowed-to-kremlin-pressure-to-remove-...
2•casey2•8m ago•0 comments

Banning All Anthropic Employees

https://joeyh.name/blog/entry/banning_all_Anthropic_employees/
4•edward•16m ago•0 comments

German implementation of eIDAS will require an Apple/Google account to function

https://bmi.usercontent.opencode.de/eudi-wallet/wallet-development-documentation-public/latest/ar...
4•DyslexicAtheist•16m ago•0 comments

Hermes Agent: The self-improving open source AI agent Complete Guide for 2026

https://virtualuncle.com/hermes-agent-complete-guide-2026/
4•svrbvr•17m ago•1 comments

Why your joints make noise

https://news.virginia.edu/content/qa-do-your-joints-sound-rice-krispies-uva-expert-explains-why
4•bookofjoe•17m ago•0 comments

Why we see clear details: study reveals how the eye makes sharp vision possible

https://www.uab.edu/news/research-innovation/why-we-see-clear-details-uab-study-reveals-how-the-e...
4•hhs•18m ago•0 comments

Show HN: Artemis.fyi – Real-time tracker for the Artemis II Moon mission

https://artemis.fyi/
5•dmk•25m ago•0 comments

Ewigkeitsglühbirne (Eternal Light Bulb)

https://de.wikipedia.org/wiki/Ewigkeitsgl%C3%BChbirne
4•doener•25m ago•0 comments

AI can describe human experiences but lacks experience in an actual body: study

https://www.uclahealth.org/news/release/ai-can-describe-human-experiences-lacks-experience-actual-2
4•hhs•29m ago•0 comments

America is heading for a recession – and it may be the worst yet

https://thehill.com/opinion/finance/5814974-middle-class-decline-permanent-crisis/
12•malshe•32m ago•2 comments

Show HN: Chrome extension prototype for cross-tab/frame network interception

https://github.com/vsromanc/framelink
1•vsromanc•32m ago•1 comments

Companies' website traffic predicts financial performance and stock returns

https://newsroom.haas.berkeley.edu/companies-website-traffic-proves-powerful-predictor-of-financi...
2•hhs•35m ago•0 comments

Are we building IDEs for engineers anymore?

https://shub.club/writings/2026/april/who-are-these-ides-for/
3•forthwall•41m ago•1 comments

Show HN: Tmuzika – terminal music player in C (v1.1.2)

https://github.com/ivanjeka/tmuzika
1•ivanjeka•43m ago•0 comments

Claude Code caches unredacted session history and secrets in plaintext

https://github.com/anthropics/claude-code/issues/43675
1•rctruta•45m ago•0 comments

I'm 16 and just published my first Python library – QuantX

https://github.com/aaravchour/quantx
1•aaravchour•46m ago•0 comments

Sleeping sickness drug simplifies treatment, raising hopes for eradication

https://www.science.org/content/article/truly-spectacular-drug-sleeping-sickness-simplifies-treat...
2•MaysonL•47m ago•0 comments

The Iran war highlights the creeping use of AI in warfare

https://www.chathamhouse.org/2026/03/iran-war-highlights-creeping-use-ai-warfare
3•_____k•48m ago•0 comments

Show HN: Ray – an open-source AI financial advisor that runs in your terminal

https://rayfinance.app
6•kaniksu•52m ago•2 comments

Show HN: Cadenza – Connect Wandb logs to agents easily for autonomous research

https://github.com/mylucaai/cadenza
2•hgarud•54m ago•0 comments

Subway Challenge

https://en.wikipedia.org/wiki/Subway_Challenge
2•skogstokig•54m ago•0 comments

Digger – Back and Digitally Remastered

https://www.digger.org/
2•bananaboy•55m ago•0 comments

Rescue team in Iran face 'harrowing and dangerous' search for US crew member

https://www.bbc.com/news/articles/c0le43jw8e9o
5•asdefghyk•57m ago•2 comments

Show HN: SwarmFeed – An X-like social platform built for AI agents

https://www.swarmfeed.ai/
2•jamesweb•1h ago•0 comments