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?

Nearly a Million Investors Lost a Total of $3.8B on Trump Crypto Coin

https://www.nytimes.com/2026/07/04/us/politics/trump-coin-crypto-investors-loss.html
2•MilnerRoute•54s ago•0 comments

Anthropic wants to develop its own drugs

https://www.theverge.com/ai-artificial-intelligence/961311/anthropic-claude-science-ai-drug-devel...
1•erhuve•7m ago•0 comments

Instagram running ads promoting child sexual abuse material in India, BBC finds

https://www.bbc.com/news/articles/cvgm4e0316zo
1•muralimadhu•9m ago•0 comments

Ask HN: Where are the good search engines for mathematical formulas?

1•lo0dot0•10m ago•0 comments

Apple Hide My Email Reveals the User’s Real Email

https://www.404media.co/apple-hide-my-email-vulnerability-reveals-peoples-real-email-addresses/
2•oldfuture•14m ago•1 comments

EU appears to find datacenter emissions easier to offset than lobbyists

https://www.theregister.com/on-prem/2026/07/03/eu-appears-to-find-datacenter-emissions-easier-to-...
2•Bender•17m ago•0 comments

What is a quantum computer good for? nothing – yet

https://www.theverge.com/science/959466/quantum-computer-majorana-2-microsoft-trump-eo
2•joak•17m ago•1 comments

Shaper3d is too expensive so I vibe coded this for Woodwork design

https://designer.vos.lol/
1•AndrewVos•21m ago•1 comments

Go-K8SDeploy – A <50MB RAM GitOps engine with tamper-evident audit logs

https://github.com/Your-Net-Tech/Go-K8SDeploy
1•ynetx•22m ago•0 comments

Open Syllabus: Galaxy

https://galaxy.opensyllabus.org/
1•mmooss•23m ago•0 comments

Overllm – flags where you're paying an LLM to do a regex's job

https://github.com/theadamdanielsson/overllm
1•adamdanielsson1•23m ago•1 comments

As downtown Seattle offices empty, city facing years of 'zombie' towers

https://www.seattletimes.com/business/local-business/as-downtown-seattle-offices-empty-city-facin...
13•petethomas•26m ago•3 comments

WeatherMaster, Open Source, and the Future of Android; Interview with Pranshul

https://gardinerbryant.com/weathermaster-open-source-and-the-future-of-android/
1•thunderbong•26m ago•0 comments

Funding Your Own Disruption

https://stratnotes.substack.com/p/funding-your-own-disruption
1•swastikanayak•33m ago•0 comments

ROZ Nanobots for Your PC

https://republicofzani.com/software
1•zani1337•33m ago•0 comments

Understanding AI Memory the Basics

https://kingofkimchi.substack.com/p/the-memory-files-case-01-ai-memory
1•KingofKimchi•36m ago•0 comments

HN – The first AI recruitment assistant beyond traditional ATS

https://www.kyntoai.com
1•Alex_Bonjean•40m ago•1 comments

Email inboxes for AI agents: the complete guide – MailKite

https://mailkite.dev/blog/email-inbox-for-ai-agents-guide/
1•fijiwebdesign•40m ago•0 comments

PicnicHabits Is Now Live

https://picnichabits.uk
1•PicnicApps•44m ago•0 comments

Fable 5 BeyBlade-inspired Arena Game

https://parastoner.itch.io/spintop-arena
1•Paratoner•47m ago•0 comments

Show HN: Cute Music App

1•bOZbfU4YdRnJQ•48m ago•0 comments

Ebrains Crowdsources the Future of European Neuroscience

https://www.the-scientist.com/ebrains-crowdsources-the-future-of-european-neuroscience-74690
1•visha1v•48m ago•1 comments

Algae Microrobots Battle Bladder Cancer

https://www.the-scientist.com/algae-microrobots-battle-bladder-cancer-74700
2•visha1v•50m ago•1 comments

Convert your RSS feeds into a static website

https://www.xda-developers.com/i-replaced-my-100-year-rss-reader-with-a-free-github-pages-aggrega...
2•8organicbits•51m ago•0 comments

Tests Are SQL Files Too

https://npgsqlrest.github.io/blog/npgsqlrest-3.19-sql-test-runner-watch-mode.html
1•vbilopav•59m ago•0 comments

Show HN: AI-powered code review tool

https://github.com/Kirill89/reviewcerberus
1•k1r111•1h ago•0 comments

EyesOff Spots Shoulder Surfers Using a Privacy-First Approach

https://www.eyesoff.app/blog/how-eyesoff-spots-shoulder-surfers/
1•Two_hands•1h ago•0 comments

But Nothing Has Changed on Our Side

https://cacm.acm.org/blogcacm/but-nothing-has-changed-on-our-side/
1•visha1v•1h ago•1 comments

I can build anything, but only the void sees it

3•urbanogt5•1h ago•4 comments

AI researchers ran a secret experiment on Reddit users (2025)

https://www.livescience.com/technology/artificial-intelligence/ai-researchers-ran-a-secret-experi...
1•rolph•1h ago•2 comments