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?

Antarctica's west coast missing an area of sea ice the size of France

https://www.theguardian.com/world/2026/jun/13/antarcticas-west-coast-missing-an-area-of-sea-ice-t...
1•ljf•1m ago•0 comments

Commissioner Refuses to Let Residents Opposing Flock Speak at Meeting

https://www.404media.co/you-will-not-speak-on-flock-tonight-county-commissioner-refuses-to-let-re...
1•cdrnsf•1m ago•0 comments

Looking Forward to Postgres 19: It's About Time

https://www.pgedge.com/blog/looking-forward-to-postgres-19-its-about-time
1•xngbuilds•3m ago•0 comments

Show HN: Squishy – Claude Fabel 5 coded a game and it is good

https://squishy.franzai.com/
1•franze•4m ago•1 comments

KPMG report contained AI hallucinations on benefits of AI

https://www.ft.com/content/b3828e92-4961-4b39-84f0-c42f33be3c3f
2•1vuio0pswjnm7•4m ago•0 comments

The unlikely alliance pushing an AI sovereign wealth fund

https://www.ft.com/content/ac535e57-75c9-4f03-b921-5a0b55b156f7
1•thm•4m ago•0 comments

Some notes on getting into frontier AI labs

https://twitter.com/itsreallyvivek/status/2062924410588406118
1•gmays•5m ago•0 comments

The Last of the Great Whangdoodles

https://en.wikipedia.org/wiki/The_Last_of_the_Really_Great_Whangdoodles
1•mooreds•6m ago•0 comments

New privacy frontier: Europe eyes crackdown on smart glasses

https://www.politico.com/www.politico.eu/article/new-privacy-frontier-europe-eyes-crackdown-smart...
2•1vuio0pswjnm7•6m ago•0 comments

AI Splits the Market

https://www.poppastring.com/blog/ai-splits-the-market
1•speckx•6m ago•0 comments

SkyPilot Sandboxes: Run Agent Code on Your Own Kubernetes, at Scale

https://blog.skypilot.co/sandboxes/
3•covi•7m ago•0 comments

What's the story, Wishbone?: New documentary explores classic PBS show

https://www.npr.org/2026/05/27/nx-s1-5802365/whats-the-story-wishbone-new-documentary-explores-cl...
1•mooreds•8m ago•0 comments

SpaceX vaults over $2T valuation as stock jumps after record IPO

https://www.reuters.com/legal/transactional/after-record-ipo-musks-spacex-faces-next-test-market-...
3•JumpCrisscross•8m ago•0 comments

The Era of Multi-Agent Imagined Experience

https://odyssey.ml/the-era-of-multi-agent-imagined-experience
1•olivercameron•8m ago•0 comments

The Moon Is a Harsh Mistress

https://en.wikipedia.org/wiki/The_Moon_Is_a_Harsh_Mistress
1•mooreds•9m ago•0 comments

Exploring building a tiny FUSE filesystem

https://www.shayon.dev/post/2026/161/building-a-tiny-fuse-filesystem/
1•shayonj•9m ago•0 comments

Stocks Face Rising Risk with Mega AI Deals Ready to Flood Market

https://www.bloomberg.com/news/articles/2026-06-07/ai-s-mega-stock-deals-raise-specter-of-more-sh...
2•1vuio0pswjnm7•11m ago•0 comments

Notion Is Migrating to SwiftUI, Apple Confirms at WWDC

https://www.macrumors.com/2026/06/12/notion-is-migrating-to-swiftui/
1•tosh•11m ago•0 comments

Only 3 Days Left to Submit Comment for the Triumphal Arch

https://parkplanning.nps.gov/commentForm.cfm?documentID=151576
1•gortok•12m ago•0 comments

Data Brokers: Unregulated Forensic Analysis – No One's Happy

https://nooneshappy.com/article/data-brokers-unregulated-forensic-analysis/
1•diebillionaires•13m ago•0 comments

Skill Workshop: Turn Agent Work into Reusable Skills

https://openclaw.ai/blog/openclaw-agent-skill-workshop
1•c_internet_man•13m ago•0 comments

Transient multidomain functional improvement in Alzheimer's following psilocybin

https://www.frontiersin.org/journals/neuroscience/articles/10.3389/fnins.2026.1813281/full
1•bushwart•14m ago•0 comments

An AI agent that must produce evidence before it can say "done"

https://github.com/Aspct3434/Distill-Agent
1•aspctpro•15m ago•0 comments

I Launched Founder.best

https://www.founder.best
1•anujshashimal•15m ago•0 comments

A PDF that changes based on who is reading

https://sgaud.com/texts/pdf
3•SarthakGaud•15m ago•0 comments

Turn your site into a place people can bump into each other

https://cauenapier.com/blog/townsquare_release/
1•cauenapier•15m ago•0 comments

The Essays of Michel de Montaigne Online

https://hyperessays.net/
2•floweronthehill•18m ago•0 comments

Rot (Return on Tokens), Product Team Health – Food for Agile Thought #548

https://age-of-product.com/food-agile-thought-548-rot-return-on-tokens/
1•swolpers•19m ago•0 comments

A real-ephemeris 3D universe explorer in the browser

https://space.pointdynamics.com/
1•apprised•19m ago•0 comments

Fossils show ancient primates had grooming claws as well as nails (2018)

https://www.floridamuseum.ufl.edu/science/ancient-primates-had-grooming-claws/
2•maxloh•19m ago•0 comments