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?

Opus 5 VendingBench

https://andonlabs.com/blog/opus-5-vending-bench
1•jlaneve•50s ago•0 comments

Host overhead is killing your inference efficiency

https://modal.com/blog/host-overhead-inference-efficiency
1•ronfriedhaber•1m ago•0 comments

Is Your Life Insurer Solvent?

https://www.theinstitutionalriskanalyst.com/post/theira874
1•petethomas•1m ago•0 comments

AWS ARR $169B, Azure ARR $124B, GCP ARR $99B

https://twitter.com/jaminball/status/2082936325897167261
1•dban•2m ago•0 comments

Vitamin D Could Lower Toxic Alzheimer's Proteins, Research Suggests

https://www.sciencealert.com/one-common-vitamin-could-lower-toxic-alzheimers-proteins-research-su...
1•brandonb•2m ago•0 comments

Train Simulator Controller

https://z80.me/blog/tsc-2026-july/
1•austinallegro•3m ago•0 comments

RFC 8890: The Internet is for End Users (2020)

https://www.rfc-editor.org/info/rfc8890/
1•maxloh•3m ago•0 comments

C++ float-to-int conversion can be undefined behavior

https://kttnr.net/blog/cpp-float-to-int-conversion-undefined-behavior/
1•colejohnson66•4m ago•0 comments

Trump Weighs $100k Fee for Foreign Students to Work Post-Grad

https://news.bloomberglaw.com/daily-labor-report/trump-weighs-100-000-fee-for-foreign-students-to...
2•petethomas•6m ago•0 comments

The Future of Frontier Labs' Revenue

https://spateder.com/projects/20260730/frontierlabsrevenue
1•spateder•9m ago•0 comments

Individual Trees by Country

https://en.wikipedia.org/wiki/Category:Individual_trees_by_country
1•marysminefnuf•9m ago•0 comments

5k Hours of Tactile Data, and Four Ways to Get It

https://topicqueue.substack.com/p/5000-hours-of-touch-and-four-ways
1•DISCURSIVE•13m ago•0 comments

The Cities That Said Yes to Drugs

https://www.theatlantic.com/magazine/2026/09/city-drug-addiction-harm-reduction-policy/687967/
1•JumpCrisscross•13m ago•1 comments

The American Dream Has Given Way to the "Great Postponement"

https://fortune.com/2026/07/29/american-dream-the-great-postponement-susan-wachter/
2•rmr_raph•13m ago•1 comments

AI before AI: The forgotten Soviet programme

https://www.france24.com/en/technology/20260730-ai-before-ai-forgotten-soviet-programme
2•yubblegum•15m ago•0 comments

GitHub Models is now retired

https://github.blog/changelog/2026-07-30-github-models-is-now-retired/
2•smokeeaasd•15m ago•0 comments

New Keyboard: Alicja v2

https://marcin.juszkiewicz.com.pl/2026/07/29/new-keyboard-alicja-v2/
1•jandeboevrie•16m ago•0 comments

Google Flow Music launches Lyria 3.5 with advances in musicality, lyrics, vocals

https://blog.google/innovation-and-ai/models-and-research/google-labs/lyria-3-5/
1•noiv•16m ago•0 comments

You have been mislead about lightbulbs

https://maurycyz.com/misc/tungsten/
1•jandeboevrie•19m ago•0 comments

Apple says iOS 27 'Restricted Mode' isn't for new Upgrade program leases

https://9to5mac.com/2026/07/28/apple-says-ios-27-restricted-mode-isnt-for-new-upgrade-program-lea...
2•JumpCrisscross•21m ago•0 comments

What happens to your private messages under 'Chat Control'?

https://www.euronews.com/my-europe/2026/07/30/what-happens-to-your-private-messages-under-chat-co...
4•billybuckwheat•22m ago•0 comments

Post by Maliciouschat.bsky.social – Bluesky

https://bsky.app/profile/maliciouschat.bsky.social/post/3mrvddhi42s26
2•untiledsource•22m ago•0 comments

Lament for the Shackled World: A prose-poem on biological vs. digital captivity

https://rentry.co/mqot3sem
1•HumMach•25m ago•0 comments

Ruling Is a Skill. Voting for It Is a Joke

https://julienreszka.com/blog/ruling-is-a-skill-voting-for-it-is-a-joke/
1•julienreszka•26m ago•0 comments

I obtained Claude Opus 5 system prompt

https://claude.ai/share/98073770-0ad9-431f-a1e7-e0243db18758
19•juleiie•28m ago•19 comments

Triple-band 2x2 MIMO Wi-Fi 7 Is this heaven?

https://mikrotik.com/product/hap_be3_media
1•gitowiec•30m ago•0 comments

Apple Reports 3Q 2026 Results: $29.8B Profit on $109.4B Revenue

https://www.macrumors.com/2026/07/30/apple-3q-2026-earnings/
2•ksec•31m ago•0 comments

Who Has the Funniest Name?

https://www.jonathanchiang.ca/blog/funniest_names.html
1•szge•36m ago•1 comments

Leadership Lessons from The Odyssey

https://danielmangum.com/posts/odyssey-leadership-lessons/
1•hasheddan•36m ago•0 comments

C64 Demo Effects Explained: Rodents in the Attic [video]

https://www.youtube.com/watch?v=uZ1atMUOUMU
2•u1hcw9nx•37m ago•0 comments