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?

GTA VI is building behavioral profiles of those who play

https://twitter.com/make_claude/status/2123908856145232060
2•tabith•2m ago•1 comments

Launching a Free file converter APP

https://play.google.com/store/apps/details?id=com.konvert.fileconverter&hl=en_US
1•uzairhussainsm•3m ago•1 comments

The secret maths problems hidden throughout Japan

https://www.newscientist.com/article/2599802-the-secret-maths-problems-hidden-throughout-japan/
1•Breadmaker•3m ago•0 comments

Microsoft suggests Registry hack to work around hotpatch woes

https://www.theregister.com/os-platforms/2026/11/20/microsoft-suggests-registry-hack-to-work-arou...
2•Bender•4m ago•0 comments

China attackers deployed AI agents that autonomously found and exploited a 0-day

https://www.theregister.com/security/2026/11/20/china-attackers-deployed-ai-agents-that-autonomou...
1•Bender•4m ago•0 comments

Show HN: Fundamental, page elements that bend a shared field and read it back

https://fundamentalengine.com/
1•zachshallbetter•5m ago•0 comments

Trump FCC declares California isn't allowed to enforce phone service rules

https://arstechnica.com/tech-policy/2026/11/fcc-orders-california-to-stop-enforcing-phone-service...
1•Bender•6m ago•0 comments

Amazon closes in on $7.5B deal to buy AI startup Decart

https://www.ft.com/content/dc7749dc-0f40-44a6-80bc-7f747d383616
1•notfried•11m ago•0 comments

Arctic: A Practical Lock-Free Adaptive Radix Tree

https://www.usenix.org/conference/osdi26/presentation/ni
1•grep_it•11m ago•0 comments

Ask HN: Advice on switching careers within software dev?

2•akudha•13m ago•0 comments

Revolt-rs: the Revolt event loop as a native PHP extension, up to 16x faster

https://blog.daniil.it/2026/11/21/revolt-rs/
1•danogentili•13m ago•0 comments

P&G to Cut Up to 30% of Product-Supply Workers Amid Automation Push

https://www.wsj.com/business/p-g-to-cut-up-to-30-of-product-supply-workers-amid-automation-push-8...
1•frank_clover•13m ago•0 comments

Corporate Gaslighting, the "All-in-One" Phenomenon, and the Agentic Reassembly

https://medium.com/@smoking2man/corporate-gaslighting-the-all-in-one-phenomenon-and-the-agentic-r...
2•Aldus551•14m ago•0 comments

A 4x faster async drop-in replacement for the MongoDB PHP extension

https://blog.daniil.it/2026/11/21/mongo-php-async-driver/
1•danogentili•14m ago•0 comments

Study points toward a potential blood test for CTE

https://www.wbur.org/news/2026/11/19/boston-university-study-biomarker-cte
1•gmays•15m ago•0 comments

Fine-tuning vision models: how expertise forms and how forgetting happens

https://andrewxhill.com/from-clip-to-bioclip-2/
2•andrewxhill•18m ago•0 comments

The New Yorker, John Hersey, and the Horrors of Hiroshima

https://engelsbergideas.com/portraits/john-hersey-and-the-horrors-of-hiroshima/
2•fanf2•19m ago•0 comments

Can you patch Ruby faster now?

https://paagman.dev/can-you-patch-ruby-faster-now/
1•Kerrick•19m ago•0 comments

"Race realism" isn't good science. Modern genetics does not support it

https://theconversation.com/race-realism-why-scientifically-flawed-approach-fails-to-present-a-re...
2•u1hcw9nx•20m ago•0 comments

C++26 is done (again) – Trip November 2026 ISO C++ standards meeting

https://herbsutter.com/2026/11/21/c26-is-done-again-trip-report-november-2026-iso-c-standards-mee...
3•flyingpast•23m ago•1 comments

Show HN: Pencil – LLM writes whiteboard lessons as JSON, a browser draws them

https://github.com/VBS2004/pencil
2•VBS2004•28m ago•0 comments

Countries open path towards 'killer robots' pact

https://www.afp.com/en/countries-open-path-towards-killer-robots-pact
5•geox•28m ago•0 comments

Show HN: Scalar codebook quantization, an interactive guide

https://myli.page/posts/202611211800-how-a-weight-fits-in-4-bits/
1•tslmy•28m ago•0 comments

The People's Code

https://thepeoplescode.us/
1•acmeyer9•29m ago•2 comments

Create Your Own VPN Server in 2026: Complete Setup Guide

https://blog.openvpn.net/create-your-own-vpn-server-in-2026-complete-setup-guide
1•DeepLogin•29m ago•0 comments

The Aims of Education – Alfred North Whitehead [pdf]

https://la.utexas.edu/users/hcleaver/330T/350kPEEwhiteheadaimstable.pdf
1•tylerdane•30m ago•1 comments

Upload2Shell · CVE-2026-125396

https://pwn.ai/upload2shell
5•f311a•31m ago•1 comments

Google makes it easier to use Gemini without training AI on your data

https://arstechnica.com/ai/2026/11/google-will-let-you-opt-out-of-ai-training-in-gemini-without-l...
1•doodlesdev•32m ago•0 comments

Show HN: Test product ideas on synthetic customers (open-source SSR skill)

https://github.com/AryamanSi17/synthetic-consumer-research
1•aryamansi1712•34m ago•0 comments

Abusing Git Trailers for Faster CI/CD

https://jonathannen.com/abusing-git-trailers/
2•jwilliams•34m ago•0 comments