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?

Chicago undergraduate mathematics bibliography (1999)

https://www.ocf.berkeley.edu/~abhishek/chicmath.htm
1•Tomte•45s ago•0 comments

Firefox vs. Chromium security in 2022, how true is it still today?

https://madaidans-insecurities.github.io/firefox-chromium.html
1•wyoh•1m ago•1 comments

GM to pay $12.75M to settle California driver privacy probe

https://www.reuters.com/sustainability/boards-policy-regulation/gm-pay-1275-million-settle-califo...
1•1vuio0pswjnm7•1m ago•0 comments

Show HN: Free C course called "C Systems Lab"

https://csystemslab.com/
1•vhcosta•4m ago•0 comments

Impact of Trump aid cuts: 9 million deaths by 2030

https://www.nytimes.com/2026/05/09/opinion/foreign-aid-cuts.html
2•marojejian•6m ago•1 comments

GM to Pay $13M to Settle Claims It Sold Californians' Driving Data

https://www.law.com/therecorder/2026/05/08/gm-to-pay-13m-to-settle-claims-it-sold-californians-dr...
1•1vuio0pswjnm7•6m ago•0 comments

sick of dealing with unwanted line breaks when you copy text from claude code?

https://github.com/aaronw122/termcopy/
1•aaronw122•7m ago•0 comments

I Hired Too Fast. I Had to Let Everyone Go. Here's What I Learned

https://comuniq.xyz/post?t=1057
2•01-_-•9m ago•0 comments

Marginal likelihood is exhaustive leave-p-out cross-validation

https://belko.xyz/posts/lml-and-cross-validation/
1•samuel2•10m ago•0 comments

It's time to talk about agentic "remote control"

https://arpadvoros.com/posts/2026/05/08/its-time-to-talk-about-agentic-remote-control/
1•arpadav•10m ago•0 comments

AI wants direct access to your data

https://matthiasplappert.com/blog/2026/ai-wants-direct-data-access/
1•sherlock_h•14m ago•0 comments

Mythos finds the vulnerabilities. VibeAI makes sure YOU understand them

https://hugonomy.com/
1•GlyphWeaver_a•14m ago•0 comments

Show HN: You can edit the game by chatting with it

https://aion.quest/
1•xkoda•15m ago•0 comments

I build software for small businesses rate my site

https://skiigen.com/
1•loui01•15m ago•1 comments

'A Four-Eyed World' Review: The Story of Spectacles

https://www.wsj.com/arts-culture/books/a-four-eyed-world-review-the-story-of-spectacles-504334ac
1•Hooke•15m ago•0 comments

The Chinese Exclusion Act (PBS Documentary)

https://www.pbs.org/wgbh/americanexperience/films/chinese-exclusion-act/
1•mkgobaco•16m ago•1 comments

The unprecedented and deadly cruise ship hantavirus outbreak

https://arstechnica.com/health/2026/05/everything-you-need-to-know-about-the-hantavirus-cruise-sh...
1•Brajeshwar•18m ago•0 comments

Piccolo: An experimental stackless Lua VM implemented in pure Rust

https://github.com/kyren/piccolo
1•tosh•18m ago•0 comments

Query Insights for Postgres, Powered by ClickHouse

https://clickhouse.com/blog/postgres-query-insights-clickhouse-cloud
1•cauchyk•19m ago•0 comments

Let's kill off half the builtins in C3 0.8.0

https://c3-lang.org/blog/lets-kill-off-half-the-builtins-in-080/
1•DASD•19m ago•0 comments

Using Rust for Game Development by Catherine West (2018) [video]

https://www.youtube.com/watch?v=aKLntZcp27M
1•tosh•21m ago•0 comments

Worried Britons 'prepping' for major disruption with stash of tins and cash

https://www.theguardian.com/business/2026/may/09/worried-britons-prepping-for-major-disruption-wi...
3•tomwphillips•23m ago•0 comments

The Memex Method

https://pluralistic.net/2021/05/09/the-memex-method/
1•ingve•24m ago•0 comments

AoS and SoA

https://en.wikipedia.org/wiki/AoS_and_SoA
1•tosh•24m ago•0 comments

VGA Memory Access Is Complicated

https://www.os2museum.com/wp/learn-something-old-every-day-part-xxi-vga-memory-access-is-complica...
1•ingve•28m ago•0 comments

Show HN: Durable async jobs for x402-paid APIs

https://github.com/clearedink/cleared-jobs
1•massanishi•28m ago•0 comments

Ask HN: Notify about DNS records propagation

1•vojtechrichter•29m ago•0 comments

Debunking the Myth That Search Is Dying

https://graphite.io/five-percent/debunking-the-myth-that-seo-traffic-has-dramatically-declined
1•paulpauper•30m ago•2 comments

InMusic and Native Instruments Unite

https://www.inmusicbrands.com/press/inmusic-native/
2•Tomte•31m ago•0 comments

A $15 RISC-V Device Built Its Own Wallet and Learned to Pay the Internet

https://www.eddieoz.com/how-a-15-risc-v-device-built-its-own-lightning-wallet-and-learned-to-pay-...
1•eddieoz•32m ago•0 comments