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?

LinguaHover – Hover Any Word, Translate Instantly – Chrome Extension

https://chromewebstore.google.com/detail/linguahover-translator-pr/dnkpfkopeeilpfgnehheceebamlcbcgc
1•titan_tokyo•3m ago•0 comments

Show HN: Mochi Analytics

https://www.mochianalytics.com
1•devtanna•4m ago•0 comments

Ask HN: Do you like your AI more than your coworker?

1•general_reveal•4m ago•0 comments

In the Weights

https://intheweights.com
1•dash2•7m ago•0 comments

Bounding the Blast Radius: A Survey of Prompt-Injection Defenses for LLM Agents

https://fabraix.com/blog/nobody-has-solved-prompt-injection
1•ibrahim_abdu777•8m ago•0 comments

What Happens When AI Agents Can Pay Their Own Bills

https://self-sovereign-agent.github.io/
1•_pdp_•13m ago•0 comments

Higher blood glucose levels linked to faster brain aging

https://medicalxpress.com/news/2026-07-higher-blood-glucose-linked-faster.html
1•XzetaU8•13m ago•0 comments

Supply Chain Attack Campaign PolinRider

https://socket.dev/supply-chain-attacks/polinrider
1•_____k•14m ago•0 comments

Poll: Is there an AI bubble?

1•networked•15m ago•1 comments

Generative AI without guardrail can harm learning:Evidence from high school math

https://www.pnas.org/doi/10.1073/pnas.2422633122
1•teleforce•15m ago•0 comments

Tribe in Colorado brings utility scale solar project online

https://www.npr.org/2026/07/06/nx-s1-5779756/despite-stiff-political-headwinds-tribe-in-colorado-...
2•geox•20m ago•0 comments

Claude Code deletes conversations after 30 days

1•mieubrisse•20m ago•0 comments

Adding Homemade TLS to a Homemade Web Server

https://www.dmytrohuz.com/p/adding-homemade-tls-to-a-homemade
1•dmyhuz•25m ago•0 comments

Euclid scientists discover most distant known quasars

https://www.euclid-ec.org/most-distant-quasars/
1•robin_reala•25m ago•0 comments

Ask HN: What is your go-to prompt to prove AI can be wrong?

1•throwaway_887•28m ago•0 comments

Ask HN: Do you guys struggle with finding a right person for your FDE role?

1•getelementbyiq•35m ago•0 comments

Experts offer advice on performing endurance events in excessive heat

https://news.northeastern.edu/2026/07/02/cycling-in-extreme-heat-tour-de-france/
1•ano-ther•36m ago•0 comments

Read Rust Like a Chinese Character

https://dawaba.pages.dev/writing/sometimes-read-rust-like-a-chinese-character/
1•saint-evan•37m ago•1 comments

A Self-Improving Code World Model Agent

https://jdsemrau.substack.com/p/a-self-improving-code-world-model
1•ph4rsikal•40m ago•0 comments

Show HN: Kiwi – Run agentic dev loops in the cloud, keep keys on your laptop

https://github.com/ibreakthecloud/kiwi
1•harshvkarn•41m ago•0 comments

Plex debuts 5-year membership pass for $250

https://arstechnica.com/gadgets/2026/07/250-used-to-get-you-a-lifetime-plex-pass-now-you-get-a-fi...
1•AndrewDucker•41m ago•0 comments

Australia prosecuting Amazon for unilaterally modifying Prime terms [video]

https://www.youtube.com/watch?v=DV2-GLJ2FnM
1•dataflow•44m ago•1 comments

Show HN: I built notion database based no code form builder

https://ndbforms.myurll.in/
1•nookeshkarri7•45m ago•0 comments

The Hitchhiker's Guide to Agentic AI

https://arxiv.org/abs/2606.24937
2•jonbaer•45m ago•0 comments

Show HN: TV Time to Serializd Importer

https://chromewebstore.google.com/detail/tv-time-→-serializd-impor/cpcfkgcidilfibakiaohbekkanlk...
1•Gooblebrai•45m ago•0 comments

your competitor is 10x better than you

https://www.mentionedby.world/
2•aykhanstoic•49m ago•1 comments

What else happened in 1776 [video]

https://www.youtube.com/watch?v=nGMCowI4exk
1•iansteyn•49m ago•0 comments

Venice AI becomes a unicorn with its privacy-first AI platform takes off

https://techcrunch.com/2026/07/01/venice-ai-becomes-a-unicorn-with-65m-series-a-as-its-privacy-fi...
2•felixdoerp•52m ago•0 comments

China fires ballistic missile into Pacific nuclear-free zone

https://www.ft.com/content/c52f0a98-2e6a-4acc-a668-d4ce442c4aba
2•cwwc•54m ago•0 comments

Roll your own file-based router in under 50 lines of code

https://wasp.sh/blog/2026/07/01/roll-your-own-file-based-router
1•cprecioso•54m ago•0 comments