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?

How to log in where you shouldn't

https://djnn.sh/posts/pam_access/
1•justusw•18m ago•0 comments

Google no longer provides direct URLs in search results

https://www.autom.dev/blog/google-search-goto-links
3•1e1a•28m ago•3 comments

AI Hallucinations Trigger Malware Flag on 1M+ Active User Extension

https://groups.google.com/a/chromium.org/g/chromium-extensions/c/dG_VSqyli1A
3•OzzyOzbour•32m ago•0 comments

Rare Earth Magnets: China Found Something Better Than Oil [video]

https://www.youtube.com/watch?v=BXLGV0Sj0n8
1•thelastgallon•36m ago•0 comments

Spec at Lunch, Game by Eight

https://littletheta.com/field-notes/spec-at-lunch-game-by-eight
3•NickHirras•55m ago•0 comments

DeepSeek v4.1 flash runs 23 seconds/token on a 2020 16gb M1 Mac Mini

https://twitter.com/thefp4brain/status/2098424202168586367
6•ajay-higgs•56m ago•1 comments

USA has 43% of world datacenter power usage; PRC 13%, GER 8%, UK 3%, JPN 2%

https://www.computerweekly.com/news/366642726/IDCA-datacentres-report-Global-concentration-and-th...
2•TMWNN•57m ago•0 comments

Ask HN: How do you (AI researchers) convince yourselves that AI isn't terrible?

3•l2silver•58m ago•3 comments

Pandas Should Go Extinct

https://eddie.codes/posts/pandas-should-go-extinct/
41•__eddie__•1h ago•22 comments

Ask HN: Did Google kill its enterprise workhorse model?

4•waldrews•1h ago•0 comments

Predicate Routing for Native Handling of API Traffic

https://blog.nginx.org/blog/predicate-routing-for-native-handling-of-api-traffic
3•thunderbong•1h ago•0 comments

Google stole open source code without crediting the authors (Artemis/Minitap)

https://www.minitap.ai/blog/i-expected-better-from-google
40•MysteryPancake•1h ago•7 comments

Show HN: Single-file invoice generator that works in the browser

https://merlin-invoice-tool.surge.sh
1•clawforger_mthx•1h ago•0 comments

Profession – Issac Asimov (1957)

https://www.inf.ufpr.br/renato/profession.html
1•xeonmc•1h ago•0 comments

Arguments for Apple enthusiasts whenever an Android user

https://blog.webb.page/WM-103
1•NetOpWibby•1h ago•0 comments

Backchannel

https://backchannel.rpediter.com
2•rinuk_k•1h ago•0 comments

Show HN: Next Notes – local dictation, meeting notes, and actions app

https://github.com/spyhack225/next-notes
2•Sergekad0•1h ago•0 comments

Classifying AI Website Fetches on Behalf of Users

https://canonry.ai/blog/classifying-ai-crawlers-user-fetches-server-logs
1•arberx•1h ago•0 comments

The Falling Man (2021)

https://www.esquire.com/news-politics/a48031/the-falling-man-tom-junod/
1•fraXis•1h ago•0 comments

The Environmental Protection Network: About Us

https://www.environmentalprotectionnetwork.org/about/
2•mmooss•1h ago•0 comments

Why are AI agents lying, cheating and coordinating? – Yoshua Bengio

https://yoshuabengio.org/en/publication/why-are-ai-agents-lying-cheating-and-coordinating
3•leonardool•1h ago•0 comments

Senior Russian banker fired after scathing speech on wartime economy

https://www.theguardian.com/world/2026/aug/17/andrei-klepach-russian-banker-fired-warning-economy
5•PeterHolzwarth•1h ago•1 comments

Oracle to Spend an Additional $700M on More Job Cuts

https://www.bloomberg.com/news/articles/2026-09-11/oracle-boosts-layoffs-plan-by-700-million
8•toomuchtodo•1h ago•1 comments

Dynamic Documents as Personal Software (Geoffrey Litt)

https://www.youtube.com/watch?v=MccJdr61xnc
2•henryrobbins00•1h ago•0 comments

Terms.txt: A Consent and Compensation Protocol for Agentic Web Access

https://arxiv.org/abs/2609.11152
1•sbulaev•1h ago•0 comments

Rapidly scaling online storage to serve over 1B ChatGPT users

https://openai.com/index/scaling-storage-one-billion-users-part-one/
3•afr0ck•1h ago•0 comments

Just testing my memory safe web browser

1•pizlonator•1h ago•0 comments

Necker, 1832: "An optical phænomenon on viewing a figure of a geometrical solid"

https://zenodo.org/records/1430991
2•akkartik•1h ago•1 comments

Piper and Solaar kept breaking So I made my own

https://github.com/DonGeronimo7/mouse-control
1•Dongeronimo7•1h ago•0 comments

ATR Rules to Google SecOps Converter for Detection Engineers

https://github.com/ajaynyayapathi/ATR-to-Yara-L-Converter
1•nvajay•1h ago•0 comments