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?

Most biomedical publications show signs of LLM-assisted writing

https://arxiv.org/abs/2608.10715
1•sbulaev•2m ago•0 comments

We picked 35 of the top young scientists and engineers

https://www.technologyreview.com/2026/08/12/1141605/2026-innovators-under-35-top-young-scientists...
1•joozio•7m ago•0 comments

Never Trust Your AI Agent's Own Sandbox

https://badshah.io/blog/never-trust-your-ai-agents-sandbox/
1•bnchandrapal•7m ago•0 comments

Show HN: FlightWifi – Know if a flight's Wi-Fi can hold a video call

https://chromewebstore.google.com/detail/flightwifi/omoclebljmjljikaoaogdpahjlbmdbin
1•Priyansh7•7m ago•0 comments

Big Tech Wants to Harvest Your Thoughts

https://www.wired.com/story/book-excerpt-the-vanishing-earth-james-crawford-brain-mining/
1•beardyw•7m ago•1 comments

Cellebrite zero-day exploit used to target phone of Serbian student activist

https://securitylab.amnesty.org/latest/2025/02/cellebrite-zero-day-exploit-used-to-target-phone-o...
1•upofadown•8m ago•0 comments

OAuth for Agents

https://blog.exe.dev/oauth-for-agents
4•tosh•13m ago•0 comments

On Hacking – What Is Hacking?

https://stallman.org/articles/on-hacking.html
4•hskimse•13m ago•1 comments

Interviewing Engineers in the AI Era: Lessons from a Year of Rebuilding

https://www.coinbase.com/en-ca/blog/interviewing-engineers-in-the-ai-era-lessons-from-a-year-of-r...
2•jreynar•13m ago•0 comments

Show HN: A declarative, SwiftUI toolkit that renders to <canvas>

https://pixdeo.github.io/weavekit/
2•mromanuk•16m ago•0 comments

Xirp

https://xirp.spotify.com/
3•geoffbp•19m ago•0 comments

Mindful Coding: Purpose and Intention

https://var0.xyz/posts/mindful-coding-purpose-and-intention.html
3•tuxie_•25m ago•0 comments

We tracked 800 European design engineer job ads. The role has no agreed title

https://hymera.co/research-design-engineer-hire-search
4•ablazevics•28m ago•4 comments

Computer Science Themed Typing Game

https://viberacer.superthread.com/
3•russellvaughan•29m ago•1 comments

List of Dirty, Naughty, Obscene, and Otherwise Bad Words

https://github.com/LDNOOBW/List-of-Dirty-Naughty-Obscene-and-Otherwise-Bad-Words
2•Bluestein•29m ago•0 comments

Show HN: BentoDesk – Elegant Windows desktop organizer powered by Rust

https://github.com/ZRainbow1275/bentodesk
2•ZRainbow•29m ago•0 comments

RoguePlanet Vulnerability Still Exploitable

https://github.com/MSNightmare/ShieldBreak
3•gaybees•33m ago•0 comments

Impulse Tracker

https://ovidem.com/impulsetracker/
3•vsvagr•34m ago•0 comments

DeepSeek: What They Invented

https://claude.ai/public/artifacts/807b5183-4704-4e63-b132-98379d1a9c80
2•_continuation•35m ago•0 comments

Manic Inventor – web utilities that don't need to see your data

https://www.manicinventor.com/
1•ManicInventor•38m ago•1 comments

Show HN: Gribble – Pixelated pixel art editor in the browser

https://gribble.app
2•napahlm•39m ago•0 comments

AI Coding and Its Discontents

https://calnewport.com/on-ai-coding-and-its-discontents/
2•encyclopedism•39m ago•0 comments

Fifty Ways to Hose Your Code

1•jjuliano•40m ago•0 comments

Change Data Feed in Databricks Delta – How to Process It the Most Efficient Way

https://medium.com/databrickscommunity/change-data-feed-in-databricks-delta-how-to-process-it-the...
1•protmaks•41m ago•0 comments

Olo (Color)

https://en.wikipedia.org/wiki/Olo_(color)
2•inigyou•43m ago•0 comments

Show HN: Huntclaw – a fast (maybe fastest) simple find-and-replace utility

https://github.com/tigerlang/huntclaw
1•tiger-langer•47m ago•0 comments

150M-parameter reasoning model sets new cost-accuracy frontier on ARC-AGI-1

https://huggingface.co/papers/2608.09888
1•meander_water•47m ago•0 comments

Create lottie animations using your coding agent

https://github.com/diffusionstudio/lottie
1•Shhdwi•50m ago•0 comments

A Demo of Charles Babbage's Difference Engine [video]

https://www.youtube.com/watch?v=BlbQsKpq3Ak
1•Bluestein•51m ago•0 comments

The Open Weight Revolution with Simon Willison (Oxide and Friends)

https://oxide-and-friends.transistor.fm/episodes/the-open-weight-revolution-with-simon-willison
1•tosh•52m ago•0 comments