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

Relaxation of US day-trading rules opens door to YOLO trading, higher risk

https://www.reuters.com/legal/government/relaxation-us-day-trading-rules-opens-door-yolo-trading-...
1•tartoran•47s ago•0 comments

"SaaS became chat". This isn't just lazy design

https://metedata.substack.com/p/006-the-chat-bar-isnt-lazy-design
1•young_mete•1m ago•0 comments

Beirut: Now and Then

https://www.lrb.co.uk/the-paper/v48/n07/charles-glass/diary
1•mitchbob•2m ago•1 comments

Airwallex is about to take on the payments industry – in the physical world

https://techcrunch.com/2026/04/15/airwallex-is-about-to-take-on-stripe-and-the-rest-of-the-paymen...
1•SilverElfin•4m ago•0 comments

EU Launches Age Verification App

https://reclaimthenet.org/eu-launches-age-verification-app
4•robtherobber•5m ago•1 comments

Claude Opus 4.7 Model Card

https://anthropic.com/claude-opus-4-7-system-card
5•adocomplete•5m ago•0 comments

LLM risk spreading misinformation to humans who are least able to identify it

https://arxiv.org/abs/2406.17737
2•sailingcode•5m ago•1 comments

Our AI agent generates schema-aware, PII-filtered SQL across 700 tables

https://merylldindin.com/thoughts/sql-agent/
1•meryll_dindin•6m ago•0 comments

Two inmates at an Ohio prison built a secret hacking operation from behind bars

https://twitter.com/i/status/2044568738767294652
2•lando2319•7m ago•1 comments

There's yet another study about how bad AI is for our brains

https://www.engadget.com/ai/theres-yet-another-study-about-how-bad-ai-is-for-our-brains-183418494...
3•speckx•7m ago•0 comments

The World in 1975 (2007)

https://www.ranprieur.com/misc/1975.html
1•downbad_•8m ago•1 comments

The Case for Doing Real, Hard Things

https://thegrowtheq.com/the-case-for-doing-real-hard-things/
1•mooreds•8m ago•0 comments

Claude Opus 4.7

https://www.anthropic.com/claude/opus
16•AlphaWeaver•8m ago•3 comments

Is Ireland the worst run country in Europe?

https://www.irishtimes.com/opinion/2026/04/11/david-mcwilliams-ireland-has-too-much-money-and-is-...
1•religio•9m ago•0 comments

Show HN: NoPII – One line of code to protect PII before it hits your LLM

https://www.nopii.co
2•mroling•10m ago•0 comments

Largest study of pregnancy sickness uncovers six new genetic links

https://medicalxpress.com/news/2026-04-largest-pregnancy-sickness-uncovers-genetic.html
2•gmays•10m ago•0 comments

Rusting Rivers: Alarm Grows over Uptick in Acidic Arctic Waters

https://e360.yale.edu/features/rusting-rivers
2•speckx•12m ago•0 comments

What Should Smart People Think About UFOs?

https://www.thefp.com/p/what-should-smart-people-think-about
1•bookofjoe•13m ago•0 comments

Claude Opus 4.7

https://www.anthropic.com/news/claude-opus-4-7
46•meetpateltech•14m ago•0 comments

A faster, cheaper Claude Code alternative with automatic provider failover

https://www.surly.dev/articles/how-to-get-95-pct-claude-code-quality-at-half-the-cost-with-hermes...
1•thesurlydev•14m ago•0 comments

Channel Hosting on Prefix.dev

https://prefix.dev/blog/welcome-channel-hosting-on-prefix-dev
1•stinos•14m ago•0 comments

When El Salvador's Prisoners Go Free, She's There to Pick Them Up

https://www.nytimes.com/2026/04/15/world/americas/sugey-amaya-el-salvador-prisoners.html
1•g2183889•14m ago•0 comments

Show HN: I've Added Gdbstub to UVM32

https://github.com/ringtailsoftware/uvm32/tree/main/hosts/host-gdbstub
1•hamid_rostami•16m ago•0 comments

Sperm Whales Speak with a Complex Alphabet and Even Have 'Vowels,' Study Finds

https://gizmodo.com/sperm-whales-speak-with-their-own-unique-alphabet-scientists-found-they-even-...
3•Brajeshwar•19m ago•0 comments

Dependencies Are Someone Else's Attack Surface

https://quodeq.ai/blog/supply-chain-attack-surface/
1•nicksergeant•19m ago•0 comments

Show HN: Sentinel – LLM browser automation using 10x fewer tokens

https://www.isoldex.ai/
1•isoldex•20m ago•0 comments

The Common AI Provider: LLM and AI Agent Support for Apache Airflow

https://airflow.apache.org/blog/common-ai-provider/
1•jonbaer•20m ago•0 comments

Apple's 'AI coding bootcamp' could help its engineers fix Siri

https://appleinsider.com/articles/26/04/15/apples-ai-coding-bootcamp-could-help-its-engineers-mak...
1•speckx•21m ago•1 comments

A system that maps relationships across mixed data sources

https://github.com/Lumen-Labs/brainapi2
1•Chrisszz•23m ago•0 comments

You Own Your Role, We Own the Outcome

https://pointc.co/you-own-your-role-we-own-the-outcome/
1•benwerd•23m ago•0 comments