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?

Towards a New House of Lords

https://marginalrevolution.com/marginalrevolution/2026/08/towards-a-new-house-of-lords.html
1•paulpauper•2m ago•0 comments

CATL now sells batteries online for $63/kWh [video]

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

As print literacy fades, our perception of truth is warping

https://bigthinkmedia.substack.com/p/as-print-literacy-fades-our-perception
1•pseudolus•3m ago•0 comments

Is AI slowing you down?

2•charbz•4m ago•0 comments

Light Comes into the Room

https://lightcomesintotheroom.com/
1•bpierre•4m ago•0 comments

Andrew Tate exaggerates and did not own supercars in photos, his lawyers say

https://www.bbc.com/news/articles/c4grxr0e5gdo
2•chistev•4m ago•0 comments

Wikipedia and other sites slow or unavailable

https://www.wikimediastatus.net/incidents/9mg9mtxfxpjl
5•lukasgelbmann•5m ago•3 comments

Vanillin flavoring in e-cigarettes disrupts embryonic stem cell development

https://news.ucr.edu/articles/2026/08/12/vanillin-flavoring-e-cigarettes-disrupts-human-embryonic...
1•geox•5m ago•0 comments

S-Xtrix-S GSM

https://github.com/Pendrax/S-XTRIX-S
1•S-XTRIX-S•6m ago•0 comments

I migrated a 4 year old PrestaShop store and made a pratical ETL guide on it

https://blog.webround.com/en/migrating-from-prestashop
2•LucaSiviero•7m ago•1 comments

Our Electric Assets – Fortescue mining operations

2•thelastgallon•7m ago•0 comments

Pgbot: A 5.9 MB read-only Postgres tool for humans and agents

https://pgbot.dev/
2•sashash•10m ago•2 comments

Rollercoaster Tycoon Wonderworks – Official Early Access Announcement Trailer [video]

https://www.youtube.com/watch?v=QWsU277r8OM
2•HelloUsername•10m ago•0 comments

Space Invaders in COBOL on an IBM 3270 [video]

https://www.youtube.com/watch?v=GvLsOkOgPA0
2•fortran77•11m ago•0 comments

Key Recovery from Residue-Confined Errors in the Pradhan CRT-RLWE Construction

https://eprint.iacr.org/2026/1734
2•lknik•11m ago•0 comments

Report of MIT's Committee on AI Use in Teaching, Learning, and Research Training

https://aiandeducation.mit.edu/
2•sebg•11m ago•0 comments

Agents on Conductor: Agents Are Workflows

https://medium.com/orkes/agents-on-conductor-architecture-for-production-ai-da5b55cc99b7
2•opiniateddev•11m ago•0 comments

AI Grinding for Fun and Cryptanalysis

https://arxiv.org/abs/2608.21986
2•lknik•12m ago•0 comments

OpenBB winding down and open-sourced

https://openbb.co/blog/openbb-belongs-to-everyone/
4•mmarian•12m ago•1 comments

Show HN: Wireshark in a TUI

https://github.com/yeet-src/pktscope
2•ok_major_9889•13m ago•1 comments

Repent, Harlequin Said the Ticktockman – Harlan Ellison [pdf]

https://files.libcom.org/files/Repent,%20Harlequin%20said%20the%20Ticktockman%20-%20Harlan%20Elli...
2•evo_9•14m ago•0 comments

A Message from the Family of Dolly Parton

https://www.instagram.com/reel/DceNXgPJyZ9/
8•earino•16m ago•2 comments

Ask HN: What business would you build if you couldn't use the internet?

2•spking•16m ago•0 comments

Show HN: Dribbling the AI Watermark Directly In-Prompt

https://www.explore-exploit.com/p/dribbling-the-ai-watermark-directly
2•jejay•17m ago•0 comments

Kids outlearn AI–and we still don't know why

https://www.technologyreview.com/2026/08/24/1141740/kids-machines-language-learning/
2•speckx•17m ago•0 comments

Wayland Found to Be "Intrinsically Faster Than X11, but Not More Efficient"

https://www.phoronix.com/news/Wayland-X11-Performance-PorteuX
1•DemiGuru•18m ago•0 comments

Show HN: I Designed a Quantum Computer

https://github.com/50shadesofgwei/pathfinder-pic-ion-chip
1•JonathanFeasby•18m ago•0 comments

Show HN: InferIt – a word puzzle where the guesses have been made

https://brej.org/inferit/
1•brejc8•19m ago•0 comments

A scale invariance property of PCA

https://jslandy.com/pca-invariant/
2•efavdb•19m ago•0 comments

Anthropic expected to tell investors it sees over $30T in potential revenue

https://www.reuters.com/business/media-telecom/anthropic-expected-tell-investors-it-sees-over-30-...
3•thewebguyd•19m ago•0 comments