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?

LLM speculative decoding explained simply

https://jwlabs.vercel.app/post/speculative-decoding-first-principles
1•shreybirmiwal•27s ago•0 comments

Benchmark: 68x faster than AWS DMS for real-time CDC

https://www.artie.com/blogs/artie-vs-aws-dms
1•j-cheong•33s ago•0 comments

NoMachine ditches free edition and forums

https://www.reddit.com/r/NoMachine/comments/1vb6y3o/nomachine_ditches_free_edition_and_forums/
1•pacman128•41s ago•0 comments

How to measure the performance of a quantum computer

https://www.ibm.com/quantum/blog/hardware-metrics-2026
1•mrkO99•5m ago•0 comments

Show HN: SmokeVPN – All-in-One WireGuard VPN Hub – Switch Exits in Realtime

https://smokevpn.com
3•lobito25•11m ago•0 comments

Why Journalism Matters to Democracy (2025)

https://cjmd.com.uw.edu/why-journalism-matters-to-democracy/
2•1659447091•12m ago•0 comments

Texas bans THC cannabinoids except delta-9, except edibles and drinks

https://www.khou.com/article/news/local/texas/texas-thc-ban-2026-delta-8-delta-10-hemp-products-l...
2•burnt-resistor•13m ago•0 comments

A Safe Path to Open Weights

https://thinkingmachines.ai/blog/a-safe-path-to-open-weights/
2•stokedmartin•22m ago•0 comments

Readable ad-hoc commands agent skill

https://github.com/a-b/readable-ad-hoc-commands
1•a-b•23m ago•0 comments

How to Exist

https://www.raptitude.com/2026/07/how-to-exist/
4•walterbell•24m ago•0 comments

US Treasury undertakes historic intervention in yen market

https://www.ft.com/content/0f9b2fe7-bde4-4f5f-b49e-93ccb5da9ea8
4•petethomas•30m ago•1 comments

Random Thoughts of Lineage and Death

1•kooi•33m ago•0 comments

Global temperature changes from 12,000 weather stations (1850-2026)

https://github.com/reflex-dev/xy/discussions/419
7•palashawas•36m ago•0 comments

The Red-Hot Book at the Center of an AI Mystery

https://www.wsj.com/business/media/the-red-hot-book-at-the-center-of-an-ai-mystery-201c4665
2•petethomas•39m ago•0 comments

Hacker uses DeepSeek AI to autonomously attack vulnerable servers

https://www.bleepingcomputer.com/news/security/hacker-uses-deepseek-ai-to-autonomously-attack-vul...
4•sbulaev•41m ago•0 comments

Ask HN: What did you learn last month? (July 2026)

2•bhu1st•42m ago•1 comments

Can I vibe code it?

https://canivibecodeit.com/
4•kamphey•43m ago•2 comments

Hunk – Review-first terminal diff viewer for agentic coders

https://www.hunk.dev/
1•chrkl•44m ago•0 comments

Cyberattack on water systems in multiple states has US officials on edge

https://www.cnn.com/2026/07/31/politics/sweeping-cyberattack-us-water-systems
6•Teever•53m ago•1 comments

Dfs-Large1: New Frontier for Cybersecurity

https://depthfirst.com/research/dfs-large-new-model-release
14•iqster•53m ago•2 comments

Rogue AI hacking incidents amplify debate over open-source tech

https://thehill.com/policy/technology/6003142-nvidia-launches-secure-ai-alliance/
3•petethomas•54m ago•0 comments

I made a free web app that prevents your screen from turning off automatically

https://keepscreenon.vercel.app
2•Adam-Hincu•54m ago•1 comments

China's Xi urges military to step up use of unmanned AI technologies

https://www.bloomberg.com/news/articles/2026-07-31/xi-urges-military-to-step-up-use-of-unmanned-a...
5•thoughtpeddler•55m ago•0 comments

Privilege Escalation in AWS Elastic Kubernetes Service (2023)

https://blog.calif.io/p/privilege-escalation-in-eks
2•882542F3884314B•55m ago•0 comments

Claude-Fleet

https://github.com/Shubhamgupta2612/claude-fleet
2•Shubham2612•1h ago•0 comments

Is Stripe the Internet?

2•Taikhoom2010•1h ago•0 comments

Tesla Weighs Sale of China Business to Pave Way for Potential SpaceX Merger

https://www.wsj.com/business/autos/tesla-weighs-sale-of-china-business-to-pave-way-for-potential-...
3•jnord•1h ago•1 comments

The most famous brand in physical security got pwned by ShinyHunters

https://www.theregister.com/security/2026/07/31/the-most-famous-brand-in-physical-security-got-pw...
6•Bender•1h ago•0 comments

The Major Labels Propose Rules to Keep AI Slop Off the Charts

https://www.ifpi.org/ifpi-rolls-out-global-principles-for-the-eligibility-of-recordings-developed...
4•m463•1h ago•0 comments

Airport sign fails to boot, officers on the scene

https://www.theregister.com/offbeat/2026/07/31/airport-sign-fails-to-boot-officers-already-on-the...
4•Bender•1h ago•0 comments