frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

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?

Good Teachers Don't Cheat

https://jasonkena.github.io/blog/posts/good_teachers_dont_cheat/
1•RevoGen•1m ago•0 comments

Can I get feedback on my llms.txt file?

https://fyikamran.com/llms.txt
1•kamran210•2m ago•0 comments

A New California Proposal Could Effectively Ban All Aftermarket Tires

https://www.caranddriver.com/news/a71475295/california-could-ban-aftermarket-tires/
1•SilverElfin•2m ago•0 comments

Europe Enters the 'Era of Deportations

https://english.elpais.com/international/2026-06-03/europe-enters-the-era-of-deportations.html
1•rawgabbit•3m ago•0 comments

We have now entered the age of Life-as-a-Service

https://bwanaerp.medium.com/how-did-everything-become-a-subscription-3101951d4769
1•instarlaxy•4m ago•0 comments

1971

https://wtfhappenedin1971.com/
1•matteohorvath•8m ago•0 comments

A minimal linear algebra library in pure Go

https://github.com/igomez10/linearalgebra
1•igomeza•13m ago•0 comments

AI Dark Output: The Visible Cost of Invisible Output

https://newsletter.semianalysis.com/p/ai-dark-output-the-visible-cost-of
1•arthurjj•16m ago•0 comments

Llms.txt is not a docs url dump

https://docsalot.dev/blog/llms-txt-for-saas-docs-what-to-include-and-what-to-skip
2•fazkan•16m ago•3 comments

"They're made out of weights"

https://maxleiter.com/blog/weights
2•MaxLeiter•17m ago•0 comments

Americans Have Grown Dramatically Anti-Data Center

https://gizmodo.com/americans-are-starting-to-really-hate-data-centers-and-its-making-the-tech-in...
3•WarOnPrivacy•21m ago•0 comments

HISE – Toolkit for building VST plugins

https://hise.dev
1•hyperific•24m ago•0 comments

Patreon Refuses to Remove YouTuber's Viral Lego Investigation

https://kotaku.com/lego-star-wars-reckless-ben-youtube-bricks-minifigs-patreon-mormon-mafia-20007...
5•healsdata•36m ago•1 comments

Body, Identity, and Lifetime in SwiftUI

https://jbakerlent.substack.com/p/body-identity-and-lifetime-in-swiftui
1•jbakerlent•39m ago•0 comments

Consensus report on the measurement of the Hubble constant at ∼1% precision

https://www.aanda.org/component/article?access=doi&doi=10.1051/0004-6361/202557993
1•bookofjoe•42m ago•0 comments

Open Source Voice Mode

https://twitter.com/harrycblum/status/2062308968228147254
1•bazlan•43m ago•0 comments

Stigmergy for capability selection in LLM agent loops (skills, tools, MCP)

https://sebastianhanke.substack.com/p/stigmergy-for-capability-selection
1•pssah4•47m ago•0 comments

Show HN: Lookspan – local-first observability for AI agents (npx lookspan)

https://github.com/JoniMartin27/lookspan
1•JoniMartin•49m ago•0 comments

Using AI for Writing Like a Responsible Adult

https://www.thediff.co/archive/using-ai-for-writing-like-a-responsible-adult/
3•Ariarule•51m ago•0 comments

Writing Code vs. Shipping Code: Productivity Effects Across AI Tool Generations

https://www.nber.org/papers/w35275
1•czinck•53m ago•1 comments

Show HN: Dictivo – local-first Mac dictation for $49 once

https://dictivo.app/
2•rswcf•54m ago•0 comments

What Is an Operator?

https://fdeblog.com/what-is-an-operator/
1•realityfactchex•54m ago•1 comments

We're temporarily restricting Show HNs because of an influx

8•cskilbeck•55m ago•3 comments

Babble and Prune

https://www.lesswrong.com/w/babble-and-prune
2•Ariarule•55m ago•0 comments

The Final Word

https://theamericanscholar.org/the-final-word/
2•tintinnabula•57m ago•0 comments

10 Years with Google Glass – Thomas Suarez (2023)

https://tomthecarrot.notion.site/10-years-with-Google-Glass-b39d8268a48d4e1089598316f721d8b4
1•tash_2s•59m ago•0 comments

Grab what you can while you can: The new reality in the South China Sea

https://www.bbc.com/news/articles/cy823n3ln29o
3•breve•59m ago•0 comments

'Driving like teenagers': Waymo robotaxis run red lights, nearly hit pedestrians

https://www.cnn.com/us/waymo-robotaxis-safety-invs
6•breve•1h ago•0 comments

Tony Gilroy Accepts Award for Andor: "Fuck the Empire "

https://kottke.org/26/06/tony-gilroy-accepts-award-for-andor-fuck-the-empire-1
6•jay_kyburz•1h ago•1 comments

Demand Is Booming for New No Tech, Repairable Tractor

https://www.404media.co/demand-is-booming-for-ursa-ag-new-no-tech-repairable-tractor/
20•jay_kyburz•1h ago•5 comments