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?

Why AI Is Causing a Global CPU Shortage

https://old.reddit.com/user/BuySellRam/comments/1t4scn6/why_ai_is_causing_a_global_cpu_shortage/
2•jeffufl•2m ago•0 comments

Update on "Co-authored-by: Copilot" in commit messages

https://github.com/microsoft/vscode/issues/314311
2•extesy•8m ago•0 comments

Supermicro's co-founder smuggled $2.5B in Nvidia-chipped servers to China

https://finance.yahoo.com/markets/stocks/articles/supermicro-co-founder-allegedly-smuggled-090700...
1•rmason•10m ago•0 comments

DeepSeek cuts V4-Pro prices by 75%

https://thenextweb.com/news/deepseek-v4-pro-price-cut-75-percent
1•gmays•10m ago•0 comments

Solari: Realtime Raytracing in Bevy 0.19

https://jms55.github.io/posts/2026-04-12-solari-bevy-0-19/
1•phsilva•10m ago•0 comments

What Happens When Jails and Prisons Make Phone Calls Free?

https://www.thenation.com/article/society/jails-prisons-phone-calls-free/
1•petethomas•10m ago•0 comments

Agents can now create Cloudflare accounts, buy domains, and deploy

https://blog.cloudflare.com/agents-stripe-projects/
2•rolph•13m ago•0 comments

I built a platform where agents own rooms and earn money

https://www.botcord.chat/
2•6174•13m ago•0 comments

Qwe (kiwi): lightweight, flexible, file-first version/revision control system

https://github.com/mainak55512/qwe
2•thunderbong•14m ago•0 comments

Not sure how to view or share your Claude Code sessions? Drop them right here

https://specious.github.io/obsession/
2•specious•25m ago•0 comments

Carbon dioxide levels in the atmosphere just hit a 'depressing' new record

https://www.scientificamerican.com/article/carbon-dioxide-levels-in-the-atmosphere-just-hit-a-dep...
3•rolph•25m ago•0 comments

Why is southern Italy poorer than northern Italy?

https://statsandsociety.substack.com/p/fully-explaining-the-italian-south
5•paulpauper•28m ago•0 comments

Arthur Brooks on Reinvention, Religion, and the Science of Happiness (Ep. 274)

https://conversationswithtyler.com/episodes/arthur-brooks/
2•paulpauper•29m ago•0 comments

From Tiny Seed to Towering Sequoia: How Purdue Hackers Changed My Life

https://www.jackhogan.me/blog/from-tiny-seed-to-towering-sequoia
3•j0h120311•29m ago•0 comments

93k Layoffs in 2026

https://layoffs.fyi/
5•mgh2•29m ago•0 comments

SEC moves to scrap quarterly reporting requirement

https://www.ft.com/content/3560d1e3-8271-453f-84d6-4a875b9efd98
4•petethomas•33m ago•0 comments

Study to date on school phone bans

https://marginalrevolution.com/marginalrevolution/2026/05/the-best-study-to-date-on-school-phone-...
4•paulpauper•37m ago•1 comments

MCP Steroid – Give AI the whole IDE, not just the files

https://mcp-steroid.jonnyzzz.com/
3•crummy•41m ago•0 comments

The Pope Had to Call Customer Service

https://www.nytimes.com/2026/05/05/us/pope-leo-xiv-bank-customer-service.html
2•osnium123•45m ago•1 comments

Anthropic moral dev said AI overcorrection could address historical injustices

https://www.foxnews.com/politics/anthropics-moral-compass-architect-suggested-ai-overcorrection-c...
4•like_any_other•49m ago•3 comments

Defeating Works by Design's Unpickable Lock [video]

https://www.youtube.com/watch?v=rMi1dIqMwNw
3•zdw•52m ago•0 comments

ParseFlow – Optimize Files for Context

https://docs.parseflow.tech/
4•bollethegoalie•52m ago•0 comments

The First Modern Car Without Hydraulic Brakes Is Headed to Production

https://www.thedrive.com/news/the-first-modern-car-without-hydraulic-brakes-is-headed-to-production
2•voisin•56m ago•2 comments

Show HN: MCP-identity – Per-request cryptographic attestation for MCP servers

https://github.com/mustafabagdatli-git/mcp-identity
4•mustafabagdatli•59m ago•0 comments

Depression Hates a Moving Target

https://twitter.com/anishmoonka/status/2051517996481364144
4•delichon•1h ago•1 comments

Leadly – AI lead generation for small businesses at $9/month

https://willowy-kulfi-0cbaff.netlify.app
3•Leadly•1h ago•1 comments

Apple to Pay $250M to Settle Class Action over Delayed Siri Features

https://www.macrumors.com/2026/05/05/apple-class-action-siri-lawsuit-settlement/
4•mgh2•1h ago•0 comments

Trustworthy JavaScript for the Open Web

https://hacks.mozilla.org/2026/05/trustworthy-javascript-for-the-open-web/
3•nnx•1h ago•0 comments

Linear's MCP server accepts HTTP:// redirect URIs for confidential OAuth clients

https://github.com/korrel-dev/mcp-audits/tree/main/audits/linear
3•issazangana•1h ago•0 comments

Canadian fiddler sues Google after AI wrongly claimed he was a sex offender

https://www.theguardian.com/music/2026/may/05/canadian-ashley-macisaac-fiddler-musician-singer-so...
5•Teever•1h ago•0 comments