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?

Boston Dynamics Appoints Rohit Prasad as Chief Executive Officer

https://bostondynamics.com/news/boston-dynamics-appoints-rohit-prasad-as-chief-executive-officer/
1•ilreb•56s ago•0 comments

ESP32-C3 Adblock

https://github.com/M-Abozaid/esp32-c3-adblock
1•jayhoon•58s ago•0 comments

Ask HN: What Is Your Personal Backup Methods

1•Crontab•1m ago•0 comments

Ask HN: What do you think about Fractional CFOs

1•mtmosestn•3m ago•0 comments

The Zizians [video]

https://www.youtube.com/watch?v=C0HYotaCvcg
1•TorontoTheGood•7m ago•0 comments

The Unmillenium Problems

https://twitter.com/noemititarenco/status/2107603669969412160
1•dvt•10m ago•0 comments

Jev-Driven SRE Diagnosis: What Worked and What Failed

https://www.sregym.com/blog/jev-driven-sre-diagnosis
1•matt_d•12m ago•0 comments

The Source Code Is the Detailed Design

https://wiki.c2.com/?TheSourceCodeIsTheDetailedDesign
1•kmstout•15m ago•0 comments

Show HN: YAVCHN, Yet Another Vibe-Coded Hacker News (Reader)

https://yavchn.com/hn/
1•paulmooreparks•15m ago•0 comments

Show HN: TerrainSR – fast, realistic heightmap upscaling model

https://huggingface.co/joe-gibbs/terrainsr
3•joegibbs•16m ago•1 comments

OpenAI Decisions API is now available in Public Beta

https://community.openai.com/t/decisions-api-is-now-available-in-public-beta/1403877
1•soheilpro•18m ago•0 comments

Poll HN: Is there a skill to coding with AI?

2•jv22222•19m ago•2 comments

Halo 3 Quotes

https://www.imdb.com/title/tt0494232/quotes/
1•marysminefnuf•20m ago•0 comments

Sierra Club sues San Francisco, claims city is fabricating its water needs

https://www.sfchronicle.com/climate/article/sierra-club-san-francisco-lawsuit-22465761.php
1•littlexsparkee•23m ago•0 comments

China's LinkedIn Espionage Is Only Getting More Advanced

https://thediplomat.com/2026/10/chinas-linkedin-espionage-is-only-getting-more-advanced/
1•snarky-comments•24m ago•0 comments

My Husband Has Found a New "Helper" During His Solo Time. It's My Nemesis

https://slate.com/advice/2026/10/sex-advice-husband-masturbation-aid.html
2•snarky-comments•30m ago•1 comments

Jev-as-a-Judge for Agent Evaluations

https://academy.dair.ai/resources/jev-as-a-judge
1•omarsar•33m ago•0 comments

Competing in a Stacked Market

https://iter0.com
1•inchwormz•37m ago•0 comments

Llama.cpp and WebGPU = Client-side LLMs [video]

https://www.youtube.com/watch?v=TvVhzroY72E
4•TriteJin•38m ago•0 comments

Anagrams.lol

https://anagrams.lol
1•flwns•38m ago•0 comments

The newest author at Machu Picchu is a rope

https://write.as/6z2ws92fkul5v
1•ellie_walks•39m ago•0 comments

Show HN: Puppet Master – Manage coding agents at scale

https://puppet-master.xyz/
1•chrismoos•43m ago•0 comments

OpenSSH no longer sandboxed on macOS

https://twitter.com/canadianbryan/status/2107579608635687050
1•newman314•43m ago•0 comments

The Architecture of Digital Sovereignty

https://freedom.czr.one/
2•cezarcezarcezar•48m ago•0 comments

Show HN: ZWhispr – Three speech models are better than one

https://zwhispr.com/
2•jakobov•51m ago•0 comments

Tiberava – Caesar, Total War, and a touch of roguelite

https://tiberava.pages.dev/
1•cleaninstalled•54m ago•1 comments

Would you quit sleeping if you could?

https://endsdontjustifythemeans.com/p/would-you-quit-sleeping
2•bookofjoe•54m ago•2 comments

The Hardest Part of Using AI

https://www.makonea.com/en-US/casual/the-hardest-part-of-using-ai
2•jdw64•55m ago•0 comments

Advancing Computer Use with Ironclad

https://openai.com/index/advancing-computer-use-with-ironclad/
1•apetresc•55m ago•0 comments

Instantsite – Websites from a Prompt

https://apnews.com/press-release/ein-presswire-newsmatics/press-release-58b70d19d4b6bfb09474e9f1c...
1•tolka•59m ago•0 comments