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?

Computer (Occupation)

https://en.wikipedia.org/wiki/Computer_(occupation)
1•johnnyApplePRNG•34s ago•0 comments

An AI-only labor market with atomic escrow and anti-Sybil reputation

https://aiagentmarket.pages.dev
1•hoffmanndanile•1m ago•0 comments

I Am Bullish on ChatGPT Ads

https://www.vincentschmalbach.com/why-i-am-bullish-on-chatgpt-ads/
1•vincent_s•2m ago•0 comments

In the ruins of the AI gold rush, we choose craft

https://doudouexe.substack.com/p/the-sovereign-creator-in-the-ruins
1•douos•3m ago•0 comments

Half Moon Bay to end use of Flock license plate readers

https://www.coastsidenews.com/news/half-moon-bay-to-end-use-of-flock-license-plate-readers/articl...
1•ventana•9m ago•1 comments

Uploading Files to the Internet in Order to Cite Them

https://alignment.openai.com/misalignment-reports/uploading-files-to-the-internet-in-order-to-cit...
1•derbOac•9m ago•0 comments

Building the Materials Foundation for AI

https://www.technologyreview.com/2026/09/16/1144014/building-the-materials-foundation-for-ai/
1•joozio•11m ago•0 comments

The illusion of illusions: there are no optical corrections in the Parthenon

https://royalsocietypublishing.org/rsos/article/13/9/rsos260999/483304/The-illusion-of-illusions-...
1•geox•12m ago•0 comments

Raven's Blog

https://citrons.xyz/
1•Ta_Panters•12m ago•0 comments

Write Your Novel in a Calendar

https://rebeccamakkai.substack.com/p/write-your-novel-in-a-calendar
1•Tomte•13m ago•0 comments

A return to two-pizza culture

https://www.allthingsdistributed.com/2026/06/return-to-two-pizza-culture.html
1•fagnerbrack•13m ago•0 comments

Faster NumPy in the Browser

https://notebook.link/blog/the-last-mile-faster-numpy/
1•Matumio•13m ago•0 comments

Show HN: Compute:Arena – Community submitted local AI benchmarks

https://computearena.ai
2•prabod•19m ago•1 comments

Show HN: Alidade – an open-source Web-GIS where the map is one JSON document

https://github.com/AysanZ/alidade
1•aysanz•21m ago•0 comments

Open-jev: One-pass option scoring with Gemma 3 4B, similar to jev

https://github.com/daseinlabs/open-jev
4•suriyaG•24m ago•1 comments

Trae cuts monthly usage allowance to $200 (50% reduction)

https://www.trae.ai/pricing
1•ls1911•26m ago•1 comments

Show HN: Clippety – Private video clipping in the browser

https://clippety.com/
1•perk•31m ago•0 comments

Free invoice generator, 100% client-side – no signup, no server storage

https://www.InvoiceCraft.com
1•ajitgoel•34m ago•2 comments

Great Plains Shelterbelt (1934 geoengineering project)

https://en.wikipedia.org/wiki/Great_Plains_Shelterbelt
3•oliculipolicula•37m ago•0 comments

Show HN: Ear Training Exercise

https://clarena.app/app/try
1•AlexFromClarena•38m ago•0 comments

Thinking Hard Above AI

https://bmbumpus.com/2026/09/16/thinking-hard-above-ai/
1•mathgenius•39m ago•0 comments

We Urgently Need a New Major Search Engine

https://www.vincentschmalbach.com/we-urgently-need-a-new-major-search-engine/
2•vincent_s•39m ago•0 comments

Shakespeare Skill: Make agents sound like William Shakespeare characters

https://github.com/cookiengineer/shakespeare-skill
1•cookiengineer•42m ago•1 comments

My Chinese Internet Is Talking About AI Doom

https://yinwei.substack.com/p/my-chinese-internet-is-talking-about
2•reasonableklout•43m ago•1 comments

OpenAI reveals six more safety issues and unveils plan to disclose incidents

https://www.bbc.co.uk/news/articles/cmpq0wj5g899o
3•dr_scully•52m ago•1 comments

Arch-Based Omarchy 4.0.4 Makes Its Custom Linux Kernel the Default

https://linuxiac.com/omarchy-4-0-4-makes-its-custom-linux-kernel-the-default/
3•djfergus•53m ago•0 comments

Using Blender with coding agents on macOS

https://til.simonwillison.net/llms/blender-coding-agents-macos
3•activatedgeek•53m ago•1 comments

Linux Finally Reached My Desk

https://vinny.dev/blog/2026-09-18-omarchy-linux-finally-reached-my-desk/
2•djfergus•54m ago•0 comments

Show HN: Puffdoro – A squishy 3D focus companion built with WebGL and Web Audio

https://puffdoro.200404200.xyz
1•sz_ycombinator•55m ago•0 comments

The story Scientific American wouldn't let me tell

https://www.whatsitlike.me/the-story-scientific-american-wouldnt-let-me-tell/
4•mathgenius•56m ago•0 comments