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?

Scientist Proposes Consciousness Might Be the Fabric of Reality Itself

https://www.sciencealert.com/what-if-the-brain-doesnt-create-consciousness-scientist-proposes-it-...
1•alexfromapex•53s ago•0 comments

We lost $270 building a Polymarket trading bot

https://uruguabot.com/blog/we-lost-270-building-a-polymarket-bot.html
1•Uruboi•2m ago•0 comments

Trying to fill out a PDF with AI

https://twitter.com/DanielLockyer/status/2087542891677671526
1•nreece•2m ago•0 comments

Patime – GitHub Profile Activity Customize

https://github.com/Liyfez/Pastime
1•liyfez•2m ago•0 comments

Behold the 'glueball,' a new form of matter

https://www.science.org/content/article/behold-glueball-strange-new-form-matter
1•pseudolus•3m ago•0 comments

Original 35mm Reel of STAR WARS (1977) No Fade, near perfect condition [video]

https://www.youtube.com/watch?v=6YnpvQOnHRc
1•austinallegro•3m ago•0 comments

GenAI Is a Lens into Humanity

https://aethermug.com/posts/gen-ai-is-a-lens-into-humanity
1•meetpateltech•4m ago•0 comments

How Go detects struct copies with sync.noCopy

https://func25.dev/posts/go-sync-nocopy/
1•func25•4m ago•0 comments

The Cutaway Illustrations of Christopher Cushman

https://technicalillustrators.org/2019/12/christopher-cushman/
1•gyomu•5m ago•0 comments

Rustc_codegen_JVM: Compile Rust to Java bytecode and runnable JARs

https://github.com/IntegralPilot/rustc_codegen_jvm
1•integralpilot•5m ago•0 comments

Show HN: Read it easy – Read-only code editor with an improved Go to Definition

https://www.readiteasy.app/
2•YY-EN40P•7m ago•0 comments

Show HN: AI Flight Recorder – record, replay, and track AI session costs

https://github.com/AllThingsSmitty/ai-flight-recorder
1•AllThingsSmitty•7m ago•0 comments

Snapdok–url to pdf and screenshot API on real Chromium

https://snapdok.io
1•dxsd•8m ago•0 comments

Nobody wrote or prompted 49.5% of the code in GitHub's top 100 repos in 180 days

https://fathohm.dev/dark-index
1•ashrivastavaa•8m ago•0 comments

A ledger of which of your own AI architectural decisions you could defend

https://github.com/Dupflo/decision-ledger
1•dupflo•11m ago•1 comments

Postgres 19: Write-ahead logging levels and effective_wal_level

https://www.buraksen.dev/articles/wal-levels-in-postgres-and-effective-wal-level-in-pg19
2•buraksen•12m ago•0 comments

The Agent-Led Growth Framework

https://agentledco.substack.com/p/whats-agent-led-growth
1•hsantana8•12m ago•0 comments

Show HN: RBEK – governed execution for AI agent

https://github.com/rbekplatform/rbek
1•nunomendesfreit•13m ago•0 comments

A controversial Alzheimer's surgery is said to reverse symptoms

https://www.nature.com/articles/d41586-026-02448-x
2•sohkamyung•13m ago•0 comments

Can I get a hug? Serving a site from a handheld

https://r36s.lowio.xyz
1•LowFlowIO•15m ago•0 comments

The First Chatbot's Multiple Personalities

https://spectrum.ieee.org/eliza-chatbot-source-code
1•surprisetalk•16m ago•0 comments

Anthropic reportedly plans a $2T IPO in October

https://fortune.com/2026/08/13/anthropic-ipo-2-trillion-october-largest-ever-spacex/
2•mapleoin•16m ago•0 comments

Banning Open-Weight AI Models Could Cost America the AI Race

https://www.realclearmarkets.com/articles/2026/08/13/banning_open-weight_ai_models_could_cost_ame...
2•RickJWagner•19m ago•0 comments

Beyond WASI: Running any Rust application in the browser with BrowserPod 3.0

https://labs.leaningtech.com/blog/browserpod-rust
1•yuri91•20m ago•0 comments

EU import fee changes: How per-HS-code duties hit hardware prototyping

https://tracestomarket.substack.com/p/brussels-assassination-attempt-at
1•Axellabs•20m ago•0 comments

GPTs in ChatGPT creation getting retired

https://help.openai.com/en/articles/8554407-gpts-in-chatgpt
2•realsarm•23m ago•0 comments

Rogue AI Agents Aren't Evil. They're Just Eager to Please

https://www.wired.com/story/rogue-ai-is-just-misunderstood/
1•smurda•23m ago•0 comments

Ask HN: How to deal with gen AI as an gen AI-resistant person

3•moon2•23m ago•1 comments

The longest ballot in British electoral history

https://www.bbc.co.uk/news/articles/clyem5lg78qo
2•zeristor•25m ago•0 comments

Show HN: I graded 83 AI vendors on data residency, training and subprocessors

https://sovereignairegistry.com
2•fabijanbajo•25m ago•0 comments