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•10mo 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•10mo 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•10mo 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•10mo 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•10mo ago
Load test against a clone instead of a DB whose contents you care about?

Why Are BART and MUNI always broke(n)?

https://aakash.substack.com/p/why-are-bart-and-muni-always-broken
1•logicx24•1m ago•0 comments

Where do AI-built apps usually break when moving from prototype to production?

https://openbaton.com/
1•kellonedwards•1m ago•1 comments

Third-party Claude harnesses will now draw from extra usage

2•iBelieve•3m ago•0 comments

Resurrecting Supermaven: Trad coding is not dead. Just different

https://github.com/nhlmg93/supertab.nvim
1•nhelmig93•4m ago•0 comments

Show HN: SpeechSDK – free, open-source SDK that unifies all AI voice models

https://www.speechsdk.dev/
2•PiersonMarks•5m ago•0 comments

Compliance at scale and why TAM distracts with Christina Cacioppo of Vanta

https://cheekypint.substack.com/p/compliance-at-scale-and-why-tam-is
1•hhs•5m ago•0 comments

Trump announces 'fraud' crackdown in Democratic states as arrests begin in CA

https://www.theguardian.com/us-news/2026/apr/03/trump-vance-fraud-arrest-crackdown-california
2•mitchbob•6m ago•0 comments

Forest Service Will Close Research Stations That Study Wildfire Risk

https://www.nytimes.com/2026/04/03/climate/forest-service-research-stations.html
1•mitchbob•7m ago•0 comments

Anthropic no longer allowing Claude Code subscriptions to be used with OpenClaw

9•firloop•9m ago•3 comments

Researchers develop new way to detect breakthroughs in science: study

https://www.binghamton.edu/news/story/6153/eureka-scientists-develop-new-way-to-detect-breakthrou...
1•hhs•13m ago•0 comments

Tokenizer That Outperform Tiktoken with O200k_base

https://o200k-tokenizer-70fe25.gitlab.io/
1•nispin•14m ago•0 comments

Tinnitus: At a crossroad between phantom perception and sleep (2022)

https://academic.oup.com/braincomms/article/4/3/fcac089/6563428
2•gnabgib•22m ago•0 comments

AI startup envisions '100M new people' making videogames

https://www.pcgamer.com/software/ai/this-ai-startup-envisions-100-million-new-people-making-video...
3•solomonyardley•24m ago•2 comments

Meta Pauses Work with Mercor After Data Breach Puts AI Industry Secrets at Risk

https://www.wired.com/story/meta-pauses-work-with-mercor-after-data-breach-puts-ai-industry-secre...
3•srameshc•30m ago•0 comments

'Hacks' Star Hannah Einbinder Blasts AI Creators as 'Losers'

https://variety.com/2026/tv/news/hannah-einbinder-ai-creators-losers-1236706302/
2•bogzz•33m ago•1 comments

Show HN: Standalone TurboQuant KV Cache Inference

https://github.com/g023/turboquant
3•g023•33m ago•1 comments

Darkness can "travel" faster than light speed

https://www.nature.com/articles/s41586-026-10209-z
4•Jimmc414•34m ago•2 comments

Soros: The anatomy of an agentic geopolitical simulation engine

https://asksoros.com/insights/soros-anatomy-agentic-geopolitical-simulation
4•muggermuch•34m ago•4 comments

Fake Fans

https://www.wordsfromeliza.com/p/fake-fans
3•performative•38m ago•0 comments

The Subprime AI Crisis Is Here

https://www.wheresyoured.at/the-subprime-ai-crisis-is-here/
12•dmitrygr•39m ago•0 comments

Why Millennials Love Prenups

https://www.newyorker.com/magazine/2025/12/29/why-millennials-love-prenups
5•randycupertino•40m ago•1 comments

Run Linux containers on Android, no root required

https://github.com/ExTV/Podroid
3•politelemon•41m ago•0 comments

How the Claude Mythos leak happened

https://iter.ca/post/claude-cms/
4•smitop•41m ago•0 comments

The house is a work of art: Frank Lloyd Wright

https://aeon.co/essays/frank-lloyd-wright-as-a-mirror-of-the-american-condition
9•midnightfish•42m ago•0 comments

SpaceX Files FCC Complaint over Ariane 64 Amazon Leo Launch

https://europeanspaceflight.com/spacex-files-fcc-complaint-over-ariane-64-amazon-leo-launch/
4•riffraff•44m ago•1 comments

Just 'English with Hanzi'

https://www.oldnorthwhale.com/p/why-modern-chinese-is-just-english
3•scour•45m ago•2 comments

Show HN: Open-source benchmark for transcription APIs on meeting audio

https://github.com/micdarau/meeting-transcription-bench
2•eyepaqio•46m ago•0 comments

The Cloud is a Scam (2019) [video]

https://www.youtube.com/watch?v=SCclo-eg0T8
3•mooreds•46m ago•0 comments

Did Impacts from Meteors Help Start Life on Earth?

https://www.rutgers.edu/news/did-impacts-meteors-help-start-life-earth
3•geox•51m ago•0 comments

Floating Point from Scratch

https://essenceia.github.io/projects/floating_dragon/
2•random__duck•53m ago•0 comments