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

Quint: Executable Specs for Reliable Systems

https://quint-lang.org/
1•0xcafefood•39s ago•0 comments

We built a free AI local newspaper for towns that lost theirs

https://news.minir.ai/explore?town=chesterton
1•ToukoTok•3m ago•3 comments

The HArc Stack – A Web Stack Built on Raku

https://harcstack.org
1•TheWiggles•6m ago•0 comments

Show HN: Apc-CLI – sync AI memory across Claude Code, Cursor, Copilot

https://github.com/FZ2000/apc-cli
1•FZ2000•8m ago•0 comments

Ask HN: Building on-device call screening–no cloud, just local ML. Realistic?"

1•dorjedev•9m ago•0 comments

"Warn about PyPy being unmaintained"

https://github.com/astral-sh/uv/pull/17643
2•networked•10m ago•0 comments

New Strides Made on Deceptively Simple 'Lonely Runner' Problem

https://www.quantamagazine.org/new-strides-made-on-deceptively-simple-lonely-runner-problem-20260...
1•tzury•12m ago•0 comments

Don't bet that The Pentagon – or Anthropic – is acting in the public interest

https://www.theguardian.com/commentisfree/2026/mar/03/anthropic-openai-pentagon-ethics
1•gnabgib•12m ago•0 comments

Peter Pan (1928)

https://www.gutenberg.org/cache/epub/78131/pg78131-images.html
1•petethomas•12m ago•0 comments

Local News

https://news.minir.ai/
1•MRviber•13m ago•1 comments

OpenClaw Partners with VirusTotal for Skill Security

https://openclaw.ai/blog/virustotal-partnership
1•Wjh555777•15m ago•0 comments

Chinese Open Source: A Definitive History

https://interconnect.substack.com/p/chinese-open-source-a-definitive
1•mountainview•16m ago•0 comments

The Hive Mind

https://jacquesmattheij.com/the-hive-mind/
1•BatFastard•17m ago•1 comments

Voice Agents Latency

https://substack.com/home/post/p-189696660
2•agentropy•20m ago•0 comments

Roblox Is Minting Teen Millionaires

https://www.bloomberg.com/news/articles/2026-03-06/roblox-s-teen-millionaires-are-disrupting-the-...
3•petethomas•25m ago•0 comments

Secure Snake Home (SSH)

https://snake.eieio.games
1•fratellobigio•26m ago•1 comments

How AI Is Turbocharging the War in Iran

https://www.wsj.com/tech/ai/how-ai-is-turbocharging-the-war-in-iran-aca59002
1•JumpCrisscross•30m ago•0 comments

Anthropic and The Pentagon

https://www.schneier.com/blog/archives/2026/03/anthropic-and-the-pentagon.htmll
1•benwen•31m ago•2 comments

British Columbia makes daylight saving time permanent

https://text.npr.org/nx-s1-5741076
2•bvanderveen•32m ago•1 comments

Will the U.S. confirm that aliens exist before 2027?

https://kalshi.com/markets/kxaliens/aliens/KXALIENS-27
1•pinkmuffinere•33m ago•0 comments

Metrics Make Us Miserable

https://www.derekthompson.org/p/how-metrics-make-us-miserable
1•gmays•35m ago•0 comments

Best Music Distributors in 2026

1•anonyxbiz•41m ago•0 comments

Pushing and Pulling: Three Reactivity Algorithms

https://jonathan-frere.com/posts/reactivity-algorithms/
1•frogulis•48m ago•0 comments

Science Fiction Is Dying. Long Live Post Sci-Fi?

https://www.typebarmagazine.com/science-fiction-is-dying-long-live-post-sci-fi/
10•KittenInABox•48m ago•0 comments

On the road to C4 rice: Advances and perspectives

https://onlinelibrary.wiley.com/doi/full/10.1111/tpj.14562
1•lawrenceyan•52m ago•0 comments

The Intelligence Monopoly Is Over

https://www.spatialintelligence.ai/p/the-intelligence-monopoly-is-over
1•beauzero•53m ago•1 comments

Why can't you just ask AI to find you a trading edge? You can now

https://github.com/augiemazza/varrd
1•varrd1•53m ago•2 comments

Cloud VM benchmarks 2026: performance/price for 44 VM types over 7 providers

https://devblog.ecuadors.net/cloud-vm-benchmarks-2026-performance-price-1i1m.html
25•dkechag•1h ago•2 comments

Human brain cells on a chip learned to play Doom in a week

https://www.newscientist.com/article/2517389-human-brain-cells-on-a-chip-learned-to-play-doom-in-...
3•doener•1h ago•0 comments

The San Francisco lunch that launched Silicon Valley 70 years ago

https://davidlaws.medium.com/the-san-francisco-lunch-that-launched-silicon-valley-70-years-ago-3b...
2•DavidLawsCHM•1h ago•0 comments