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?

Predicting and Altering Human Opinions

https://hunchfox.com/blog/predicting-and-changing-human-opinions.html
1•sahil_chaudhary•1m ago•0 comments

Solve the Loop: Attractor Models for Language and Reasoning

https://arxiv.org/abs/2605.12466
1•jerlendds•2m ago•0 comments

A computational constitution to stop LLM agents from bricking servers

https://github.com/misqe/zero-trust-llm
1•misqe•2m ago•0 comments

A Layman's Guide to Linux Distros

https://petrisha.club/a-laymans-guide-to-linux-distros
1•lylo•3m ago•0 comments

Building projects in the AI era for Software Engineers

https://hsnice16.medium.com/building-projects-in-the-ai-era-for-software-engineers-72f3ddcd2a40
1•hsnice16•3m ago•0 comments

Object Storage Costs Compared

https://objectcost.com
1•montyanderson•3m ago•0 comments

Show HN: Credit against tokenised stocks for agents. punish us please

https://vaaya.ai/credit-against-securities-for-agents
1•nakulkelkar•4m ago•0 comments

So software is mostly dead and hardware it is

https://twitter.com/levelsio/status/2099098086035382334
2•acopetkovic•5m ago•0 comments

Americans Go Off at Data Center Town Hall

https://www.youtube.com/watch?v=IxvjA3H8nYw
2•emsign•6m ago•0 comments

Show HN: VibeWorld – a persistent multiplayer world in your terminal

https://github.com/SorBalda/vibeworld
1•sorbalda•7m ago•0 comments

Hitting a NERVE with attacks on AI-powered brain-computer interfaces

https://anil.recoil.org/notes/nerve-attacks
3•matt_d•7m ago•1 comments

Show HN: One year in making, private/colleberative HTML5-canvas based editor

https://www.tasfer.app/en/
1•hamza512b•9m ago•0 comments

Method and system for navigating paginated content in page-based increments (2008)

https://patents.google.com/patent/US7415666B2/en
1•aragonite•10m ago•0 comments

145 Days of Uptime, 56 TiB of Traffic, One Debian Upgrade

https://sarah-robin.com/blog/debian-12-13
1•sarah-robiin•11m ago•0 comments

VR still makes 40-70% of players want to throw up

https://www.pcgamer.com/vr-still-makes-40-70-of-players-want-to-throw-up-and-thats-a-huge-problem...
3•andsoitis•14m ago•1 comments

OrigamiPhone

https://edwinarb.us/origamiphone/
1•edwinarbus•14m ago•0 comments

Cybersickness Variability by Race: Findings from 6 Studies

https://pmc.ncbi.nlm.nih.gov/articles/PMC9201708/
1•andsoitis•14m ago•0 comments

How the opium trade built one of the great cities

https://worldhistory.substack.com/p/singapore-straits-and-shadows
1•gdillard•15m ago•0 comments

Show HN: Railo – Deterministic AST security patches verified with Z3 SMT

https://www.railo.dev
1•mdzariflatif•15m ago•0 comments

Everyone Is Mossad Now

https://rosslazer.com/posts/everyone-is-mossad-now/
2•rosslazer•16m ago•1 comments

There Is No AI (It's Just People) with Jaron Lanier

https://singjupost.com/startalk-there-is-no-ai-really-its-just-people-w-jaron-lanier-transcript/
6•andsoitis•26m ago•0 comments

Show HN: Exende – 10k active jobs from 300 company sources through one API

https://www.exende.dev
1•daniellax•26m ago•0 comments

Show HN: Kibble – a reader for AI news, tutorials, code and models

https://www.kibblebites.com/app/
2•syedmubarak088•27m ago•0 comments

The Seizure of Bab El-Mandeb: Why Tanker Rates Are Exploding [video]

https://www.youtube.com/watch?v=n76tCHtJfmQ
3•toomuchtodo•28m ago•0 comments

Investment token from new economic trading platform worldwide

https://spare-change-01.vercel.app/
2•korerussbiz•29m ago•0 comments

Punish me hard. Show HN: credit against tokenised stocks for your agents

3•nakulkelkar•29m ago•1 comments

DnDGem Core – looking for developers to test content-aware layouts

https://github.com/DnDGem/dndgem
1•davideagosti62•33m ago•0 comments

Create Aeronautics Mod Release Trailer [video]

https://www.youtube.com/watch?v=SO8tpWfZjGk
1•nasso_dev•33m ago•0 comments

What if AGI is here, and it's made of children?

https://twitter.com/IAmPascio/status/2098799094835675574
1•ahmednabi•35m ago•0 comments

Raskin's Laws for Humane Computers

https://pre.hn/raskins-laws/
1•nelsonfigueroa•36m ago•0 comments