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?

7th Circuit Rules AI-Generated CSAM Is Protected Speach

https://media.ca7.uscourts.gov/cgi-bin/OpinionsWeb/processWebInputExternal.pl?Submit=Display&Path...
1•piker•1m ago•0 comments

For better or worse, Yayoi Kusama's Infinity Rooms reshaped the world

https://www.cnn.com/2026/08/28/style/yayoi-kusama-infinity-mirrors-art-impact
1•reconnecting•2m ago•1 comments

Give Coding Agents Permission, Not Just Prompts

https://engineeringspec.org/blog/give-coding-agents-permission-not-just-prompts/
1•mak8•5m ago•0 comments

One 'absolutely prolific' male bird is keeping his species alive in the U.K

https://www.cbc.ca/lite/story/9.7323206
2•colinprince•5m ago•0 comments

Building an LLM runtime in 700 lines of C

https://github.com/ryanssenn/gemma4.c
2•ryansen•9m ago•1 comments

We made a new robot – Microduck [video]

https://www.youtube.com/watch?v=RAtzEyGBGFU
1•arbayi•9m ago•0 comments

E.V. Sales Are Rising After the Gulf Oil Shock. Here's Where.

https://www.nytimes.com/interactive/2026/08/18/climate/ev-car-sales-oil-prices.html
1•bookofjoe•9m ago•1 comments

Study links listening to live metal improves tolerance for pain, cold

https://gizmodo.com/study-links-listening-to-live-metal-with-an-improved-tolerance-for-pain-cold-...
2•HieronymusBosch•16m ago•1 comments

Stamping build info in constant memory

https://fzakaria.com/2026/08/25/stamping-build-info-in-constant-memory
1•ingve•18m ago•0 comments

My answer to AI burnout: more AI (but context is king)

https://sycdan.wordpress.com/2026/08/29/my-answer-to-ai-burnout-more-ai-but-context-is-king/
1•sycdan•20m ago•0 comments

Being kicked out of the tech industry

https://www.jacky.wtf/essays/2026/kicked-out/
1•birdculture•20m ago•1 comments

Rational quantum mechanics: Testing quantum theory with quantum computers

https://www.pnas.org/doi/10.1073/pnas.2523350123
1•dustingetz•21m ago•0 comments

Show HN: VT Code – a terminal coding agent with a human-reviewed WebMCP editor

https://vinhnx.github.io/VTCode/
1•vinhnx•23m ago•0 comments

POWBlock is a universal bot/DDoS defense primitive for any server

https://github.com/8Protons/POWBlock
7•TsutomuSenkawa•27m ago•5 comments

Satellite images reveal scale of flood devastation in Nepal villages

https://www.bbc.com/news/articles/cd68vpjv21do
1•blondie9x•27m ago•0 comments

LoRA Primer

https://tinker-docs.thinkingmachines.ai/tinker/lora-primer/
1•tosh•28m ago•0 comments

Tech backlash reaches fever pitch as AI angst collides with social media fears

https://www.cnbc.com/2026/08/29/tech-backlash-ai-data-centers-elections.html
2•1vuio0pswjnm7•34m ago•0 comments

Meta's Newspaper Ad Blitz Ups Pressure on Social Media Rivals

https://www.bloomberg.com/news/articles/2026-08-28/meta-s-newspaper-ad-blitz-ups-pressure-on-soci...
1•1vuio0pswjnm7•36m ago•0 comments

Death, Dying, and the Memorialization of the Dead

https://macleki.org/stories/death-dying-and-the-memorialization-of-the-dead/
1•thunderbong•37m ago•0 comments

Show HN: Pico-Faces – A diffusion transformer image generator on a RP Pico 2 MCU

https://github.com/cpldcpu/pico-faces
4•cpldcpu•37m ago•0 comments

What It Took to Dismantle the Most Powerful Company in the World (NYT)

https://www.nytimes.com/2026/08/28/opinion/ai-power-lobbying-military-britain-east-india-company....
3•scrollop•43m ago•1 comments

Have an Agent Babysit Your Deployments

https://blog.exe.dev/athena-deploys-exe
1•gk1•48m ago•0 comments

Cod Wars

https://en.wikipedia.org/wiki/Cod_Wars
2•tosh•49m ago•0 comments

Show HN: Laser Graffiti

https://laser.consti.de
4•con•51m ago•1 comments

Berlin is being blackmailed by hackers, mayor says

https://www.bbc.co.uk/news/articles/cm2q7gv3l5qo
3•vinni2•53m ago•0 comments

Show HN: Stumpzlib – search book catalogs and drop files into Stump

https://github.com/tuckerwales/stumpzlib
3•tuckerwales•54m ago•0 comments

Skopo – a Chrome new tab limited to three priorities

https://chromewebstore.google.com/detail/skopo/nfhmabcoalbnedaimhcikokeimimejbd
1•tazumi•54m ago•0 comments

Softwares that are not tools

https://harssh.substack.com/p/softwares-that-are-not-tools
2•harhargange•57m ago•0 comments

Mycoria

https://mycoria.org/
1•Velocifyer•1h ago•0 comments

Ask HN: Best way to archive 25 years of emails

1•astatine•1h ago•2 comments