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?

Elon Musk Film Hit with Censorship

https://www.thedailybeast.com/obsessed/damning-elon-musk-film-hit-with-shocking-censorship/
1•embedding-shape•1m ago•0 comments

Show HN: EthosLM - Turn a sentence into a Minecraft city

https://github.com/chaitbuilds/EthosLM
1•chaitbuildz•3m ago•0 comments

Show HN: Jobless Joke Language (JJL), a Brainf***-inspired esoteric language

https://github.com/ghetea-patrick/jjl
1•patrick-ghetea•3m ago•0 comments

Show HN: Claude on a 2007 Nokia 6300 (Java ME app, TLS 1.0, private CA)

https://github.com/emir/claude-s40
1•emir•4m ago•0 comments

MiMo-v2.6-Flash: on intelligence/price Pareto frontier

https://artificialanalysis.ai/models/mimo-v2-6-flash
1•AnodicElegy•4m ago•1 comments

Dynep: Real-time GPU spot market across 31 cloud providers

https://data.dynep.com
1•nurturely•8m ago•0 comments

Flock seeks to have security researchers' map of Flock cameras taken down

https://www.tomshardware.com/tech-industry/cyber-security/flock-seeks-to-have-security-researcher...
3•sbulaev•11m ago•0 comments

Hello Hnu

1•Mohamed_Amineio•12m ago•1 comments

Against Political Realism

https://xd1.dev/2024/07/against-political-realism
2•gchamonlive•12m ago•1 comments

The accidental history of 3000, 8080, and other port numbers

https://smarmelling.com/posts/the-accidental-history-of-3000-8080-and-other-port-numbers.html
2•smarmelling•14m ago•0 comments

ReBirth RB-338

https://en.wikipedia.org/wiki/ReBirth_RB-338
1•gregsadetsky•14m ago•0 comments

AI in hospital billing adds nearly $1B in extra costs

https://www.bcbs.com/about-us/association-news/bcbsa-analysis-ai-coding-tools-affects-healthcare-...
2•neehao•15m ago•0 comments

Halo: An open-source, self-modifiable, agentic operating system

https://gethalo.dev/
1•tanishqkanc•16m ago•0 comments

Appeals Court Lets The Pentagon Designate Anthropic a Supply-Chain Risk

https://www.wired.com/story/appeals-court-lets-the-pentagon-designate-anthropic-a-supply-chain-risk/
1•joozio•16m ago•0 comments

Life Forge – Autonomous Flight Simulator for AI Agents

https://github.com/zariffromlatif/life-forge
1•mdzariflatif•17m ago•0 comments

Joby Completes First-Ever Autonomous Flight Across the United States

https://www.jobyaviation.com/news/joby-completes-first-ever-fully-autonomous-flight-across-the-un...
1•sssilver•17m ago•0 comments

Joplin

https://joplinapp.org
1•Tomte•18m ago•0 comments

I was impressed by Jev, please explain why I shouldn't be

3•effisfor•19m ago•4 comments

I made a website that automatically tracks API specs

https://trackapi.uk
2•iolorhys•22m ago•0 comments

For states seeking to rein in license plate cameras, New Hampshire is a model

https://newhampshirebulletin.com/2026/09/24/as-states-seek-to-rein-in-flock-license-plate-cameras...
1•chmaynard•25m ago•0 comments

Don't couple your Go code to GitHub

https://iain.rocks/blog/dont-couple-your-go-code-to-github
5•birdculture•27m ago•1 comments

The Aesthetic Problem of Namespacing

https://www.gingerbill.org/article/2026/05/13/aesthetic-namespacing/
1•signa11•27m ago•0 comments

Milestone: Write app from scratch rather than manufacturers software

https://www.bytestone.uk/posts/2026-09-27-elitech-temperature-logger/
1•hum3hum3•28m ago•1 comments

Show HN: Turn a UniFi Protect relay and sensor into a smarter garage door

https://garageopener.app/
1•pcrausaz•28m ago•0 comments

How Pink Is Pink Noise

https://ev12183725.substack.com/p/how-pink-is-pink-noise
1•ceh123•34m ago•0 comments

Creating a Reverse Outline

https://writing.wisc.edu/handbook/processandstructure/reverseoutlines/
1•Tomte•35m ago•0 comments

AMD Posts the Full EPYC 9006 SKU List: 31 Venice Parts From $700 to $14,904

https://www.storagereview.com/news/amd-posts-the-full-epyc-9006-sku-list-31-venice-parts-from-700...
2•ksec•35m ago•0 comments

Is this what SW eng has come to

2•bicepjai•35m ago•3 comments

Test Post

https://example.org/
2•RylenAnil•40m ago•3 comments

Ask HN: What's the most inspiring media you've consumed in the last 5 years?

1•hashim•43m ago•0 comments