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?

Whats Going On

1•lucasabilidebob•1m ago•0 comments

Show HN: NoClick – Build always-on agents with your existing AI subscriptions

https://www.noclick.com/
1•dhruvyads•2m ago•0 comments

Citizen of the Galaxy (full text) by Robert Heinlein

https://metallicman.com/laoban4site/citizen-of-the-galaxy-full-text-by-robert-heinlein-2/
1•speckx•2m ago•0 comments

Apple Retires iPhone Upgrade Program for Klarna-Backed Leases

https://www.macrumors.com/2026/07/28/apple-upgrade-program-klarna/
1•ksec•4m ago•0 comments

Octane: React's programming model compiled without a virtual DOM

https://octanejs.dev/
1•blweiner•4m ago•1 comments

Deserts face unprecedented flash flooding

https://www.nature.com/articles/d41586-026-02349-z
1•Brajeshwar•5m ago•0 comments

Synergize: A Turing complete esolang inspired by too many meetings

https://github.com/voidnullvalue/synergize
1•voidnullvalue•5m ago•0 comments

Basics of Understanding Chess

https://www.youtube.com/watch?v=obCtTZdL9Bo
1•sultanbasitkhan•6m ago•0 comments

Show HN: Cynative – Read-only CLI in Go that explains your live infrastructure

https://github.com/cynative/cynative
3•szin•7m ago•1 comments

We Cannot 100% Trust AI-Generated Output: A Concrete Example

https://giodicanio.com/2026/07/28/why-we-should-double-check-the-ai-output-a-bug-which-wasnt/
2•movd128•7m ago•0 comments

Why Are Gay Bars Building Databases of Their Patrons?

https://www.eff.org/deeplinks/2026/07/why-are-gay-bars-building-databases-their-patrons
4•hn_acker•9m ago•0 comments

Forensic Statistics in Python

https://www.johndcook.com/blog/2026/07/21/forensic-accounting-in-python/
2•ibobev•9m ago•0 comments

Excel Column Numbering

https://www.johndcook.com/blog/2026/07/25/excel-column-numbering/
1•ibobev•10m ago•0 comments

Cryptographic Keys and Decks of Cards

https://www.johndcook.com/blog/2026/07/28/keys-and-cards/
1•ibobev•10m ago•0 comments

The first autonomous fleet to turn your Intent into production systems

https://intentlab.ai/blog/turn-your-intent-into-production-systems
1•hi9•13m ago•0 comments

Wrapping the transverse foot arch improves running economy (2025)

https://journals.biologists.com/jeb/article-abstract/228/15/jeb250566/368675/Wrapping-the-transve...
1•bookofjoe•13m ago•0 comments

San Francisco mayor backs national robotaxi rules after Waymo meltdowns

https://www.politico.com/news/2026/07/28/san-francisco-waymo-washington-01013227
2•rurp•14m ago•0 comments

Weaponized Germs Are Deadly, Unstoppable, and Real

https://www.nytimes.com/2026/07/27/books/review/biological-war-annie-jacobsen.html
2•jibcage•15m ago•0 comments

Archive Public Hugging Face Models and Datasets as Immutable, Verifiable Trees

https://github.com/wtcross/hfcache
1•wtcross•16m ago•2 comments

The More You Buy, the More You Lose

https://www.wheresyoured.at/the-more-you-buy-the-more-you-lose/
2•crescit_eundo•17m ago•0 comments

Does every question mark deserve a Betteridge?

https://dynomight.substack.com/p/betteridge
1•crescit_eundo•17m ago•0 comments

Conway's Game of Life Using Only the Mongo Shell

https://visualeaf.com/blog/conways-game-of-life-just-using-mongo-shell/
3•Jacky101•18m ago•0 comments

Hugging Face CEO calls for transparency after unprecedented OpenAI hack

https://techcrunch.com/2026/07/26/hugging-face-ceo-calls-for-radical-transparency-after-unprecede...
1•buredoranna•19m ago•0 comments

Kimi K3 by Moonshot now available on Modal

https://modal.com/blog/kimi-k3-by-moonshot-now-available-on-modal
1•yogthos•19m ago•0 comments

Turns out the best time to post on Hacker News is when there's least competition

https://marigold.page/d/the-best-time-to-post-on-hacker-news-is--te4ghs
1•fachonrenpure•21m ago•1 comments

Build an Army of PIC12F1612-Based Blinking LED Traffic Barrels

https://bikerglen.com/blog/army-of-pic12f1612-blinking-traffic-barrels/
1•pavel_lishin•22m ago•0 comments

Prioritization Is No Prioritization

https://blog.staysaasy.com/p/the-best-prioritization-is-no-prioritization
2•gpi•22m ago•0 comments

Gemini Distillation Service

https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/tuning/distillation?hl=de
2•theanonymousone•22m ago•0 comments

At AI-Heavy Ruby on Rails Companies, Is QA-Ing and Debugging Agents the Future?

https://old.reddit.com/r/rails/comments/1v91qv2/at_aiheavy_companies_the_engineers_left_are/
2•nomilk•23m ago•0 comments

Should You Switch to Open-Weight Models?

https://www.productcurious.com/p/should-you-switch-to-open-weight
1•umangsehgal93•23m ago•0 comments