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?

Ask HN: What things might help me to become inference engineer?

1•chalshik•20s ago•0 comments

Apple 'Hide My Email' Vulnerability Reveals Peoples' Real Email Addresses

https://www.404media.co/apple-hide-my-email-vulnerability-reveals-peoples-real-email-addresses/
1•phyzome•3m ago•0 comments

Show HN: One Page Life Calendar

https://beta.actions.life
1•eltonlin•4m ago•0 comments

Egg Libor Was Also Manipulated

https://www.bloomberg.com/opinion/newsletters/2026-07-01/egg-libor-was-also-manipulated
1•greyface-•9m ago•0 comments

The Graduate-School Dropout Toppling China's Academic Stars

https://www.wsj.com/science/the-graduate-school-dropout-toppling-chinas-academic-stars-3c1e5d86
1•petethomas•12m ago•0 comments

UK-US trade deal will lead to more than 200k avoidable deaths

https://www.theguardian.com/society/2026/jul/01/us-uk-drug-deal-could-result-in-229000-excess-dea...
1•secretslol•15m ago•0 comments

Stashing data in WOFF2 color glyphs to get free Brotli decompression via Canvas

https://github.com/EtherDream/brpack/
1•etherdream•16m ago•0 comments

MacBasic (1985)

https://www.folklore.org/MacBasic.html
1•andsoitis•22m ago•0 comments

Ask HN: noticed how HN performs sentiment-analysis on everything posted here?

1•bridgettegraham•25m ago•5 comments

Nvidia Through a Crypto Miner's Eyes

https://vincentping.com/en/nvidia-through-miner-eyes
1•vincentping•27m ago•1 comments

Check Out My Website

https://topic-chat-hub--seattlem112.replit.app/
1•computerwonder•27m ago•0 comments

Kids learn to bully from adults' threats, manipulation and criticism

https://theconversation.com/kids-learn-to-bully-from-adults-threats-manipulation-and-criticism-a-...
5•1659447091•32m ago•1 comments

Show HN: Rust Backed Fast Dataloader

https://github.com/midhunharikumar/ferroload
1•midhunharikumar•34m ago•1 comments

Meta to sell excess compute, like SpaceX

https://techcrunch.com/2026/07/01/meta-like-spacex-looks-to-turn-excess-ai-compute-into-cash/
2•noashavit•35m ago•1 comments

Databricks LTAP Explained

https://sys0.substack.com/p/databricks-ltap-explained-turning
1•shenli3514•35m ago•0 comments

Konsistent: Enforce consistent code for agents and humans

https://vercel.com/changelog/enforce-consistent-code-for-agents-and-humans-with-konsistent
2•handfuloflight•36m ago•0 comments

Show HN: Meow – The 4th and final JavaScript runtime and toolchain

https://meow.style
9•ccheshirecat•39m ago•3 comments

SpaceX Hangover Spreads

https://www.ft.com/content/6a13a108-ef3e-41b5-aaba-7f61eff61ae0
2•1vuio0pswjnm7•42m ago•0 comments

Stevie: Vim Predecessor ("ST editor for vi enthusiasts")

https://en.wikipedia.org/wiki/Stevie_(text_editor)
1•erelong•43m ago•0 comments

Why is Apple asking me to pay more for Big Tech's AI obsession?

https://www.theverge.com/report/958678/apple-consumer-price-increase-ai-big-tech
3•1vuio0pswjnm7•45m ago•2 comments

Early look at Anthropic's Claude Science app for researchers

https://www.testingcatalog.com/early-look-at-anthropics-claude-science-app-for-researchers/
1•willmarch•46m ago•0 comments

Fable Is Back: This Safeguard Has Some AI in It

https://www.thealgorithmicbridge.com/p/fable-is-back-this-safeguard-has
1•swolpers•47m ago•0 comments

Making LLMs Better at Creative Writing Using Entropy

https://www.countbayesie.com/blog/2026/7/1/making-llms-better-at-creative-writing-using-entropy
2•roadside_picnic•48m ago•1 comments

Programming Quotes

https://gist.github.com/Potherca/5ffd57393a85553ab55b
1•sillysaurusx•49m ago•1 comments

A new Android malware from Google

https://f-droid.org/2026/07/01/adv-malware.html
19•drewfax•50m ago•2 comments

The Shilajit Dilemma

https://www.bloomberg.com/features/2026-shilajit-testosterone-liver-risks-maha/
2•littlexsparkee•50m ago•1 comments

Show HN: Techno Kick

https://technokick.com/
1•stagas•51m ago•0 comments

How to Tell a Real Win from Noise in a Tiny Eval

https://medium.com/@alanscottencinas/how-to-tell-a-real-win-from-noise-in-a-tiny-eval-902c89e6aa51
1•encinas88•55m ago•0 comments

Senior SWE-Bench: open-source benchmark that assesses agents as senior engineers

https://senior-swe-bench.snorkel.ai/
8•matt_d•55m ago•7 comments

Paper mill cancer studies get double the number of citations as genuine papers

https://www.nature.com/articles/d41586-026-01908-8
3•gnabgib•59m ago•0 comments