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

Show HN: SU_N an Adaptive Mesh Refinement Engine

https://github.com/colinstanfordjones/SU_N
1•RAMJAC•19s ago•0 comments

Learning from Our Mistakes: Epistemology for the Real World

https://global.oup.com/academic/product/learning-from-our-mistakes-9780197567654
1•egghack•30s ago•0 comments

Securing AI coding agents: What IDEsaster vulnerabilities should you know

https://tigran.tech/securing-ai-coding-agents-idesaster-vulnerabilities
1•tigranbs•3m ago•2 comments

Mitigation needed to avoid unprecedented multi-decade North Atlantic Oscillation

https://www.nature.com/articles/s41558-025-02277-2
1•bryanrasmussen•6m ago•1 comments

10 Most Popular Articles of the Year

https://www.honest-broker.com/p/the-10-most-popular-articles-of-the
1•paulpauper•7m ago•0 comments

Reverse Engineering Bluetooth on Amazon Kindle EReaders

https://sighery.com/posts/reverse-engineering-bluetooth-on-kindle-ereaders/
1•mattmar96•9m ago•2 comments

Frontier Models are Capable of In-context Scheming

https://arxiv.org/abs/2412.04984
1•william-evans•9m ago•1 comments

The Golden Rule of Driving

https://leroy.works/articles/the-golden-rule-of-driving/
1•leroy-is-here•10m ago•0 comments

Where Are the Beautiful Cities?

https://twitter.com/david_perell/status/2005730447897055414
3•lleims•12m ago•0 comments

Google Home Users Are Trying to Hack Their Way to a Better Voice Assistant

https://gizmodo.com/google-home-users-are-trying-to-hack-their-way-to-a-better-voice-assistant-20...
2•gnabgib•12m ago•1 comments

Cyberattack disrupts France's postal service and banking during Christmas rush

https://apnews.com/article/france-postal-service-cyberattack-4ea0c3e3bcb8a87341de8aebc1dfc916
3•gnabgib•15m ago•0 comments

Sprites: Persistent, suspendable, Linux environments as a Service

https://sprites.dev
1•nateb2022•18m ago•1 comments

The former Chinese police officer bringing bubble tea to wartorn Ukraine

https://www.theguardian.com/world/2025/dec/30/former-chinese-police-officer-bringing-bubble-tea-t...
1•mykowebhn•19m ago•0 comments

Enterprises Can Navigate Geolocation, Storage, and Privacy Compliance

https://guptadeepak.com/the-global-data-residency-crisis-how-enterprises-can-navigate-geolocation...
1•guptadeepak•22m ago•1 comments

India has surpassed Japan to become the fourth-largest economy

https://www.dw.com/en/india-overtakes-japan-as-4th-largest-economy-report-says/a-75341063
6•guptadeepak•24m ago•1 comments

ESPectre Sensor: open-source motion detection system for ESP32

https://espectre.dev/
3•882542F3884314B•25m ago•1 comments

Tatiana Schlossberg Has Died

https://www.nytimes.com/2025/12/30/us/politics/tatiana-schlossberg-dead.html
1•HR01•27m ago•0 comments

Painting with light in WebGL: terrain builder in the browser

https://medium.com/@bartoszu/painting-with-light-building-a-3d-island-in-the-browser-with-three-j...
2•bartoszu_•27m ago•0 comments

New brain implant restores lost senses using light

https://newatlas.com/medical-devices/neuro-key-implant-restore-lost-senses/
2•thunderbong•27m ago•0 comments

Show HN: Line Weaver – Image to G-Code Conversion for Pen Plotters

https://github.com/straczowski/line-weaver
1•rstraczowski•28m ago•0 comments

Junkyard Nissan V8 Lays Down Nearly 700 WHP with a Turbo and Little Else

https://www.thedrive.com/news/junkyard-nissan-v8-lays-down-nearly-700-whp-with-a-turbo-and-little...
1•PaulHoule•28m ago•0 comments

Prof. Software Developers Don't Vibe, They Control: AI Agent Coding Use in 2025

https://arxiv.org/abs/2512.14012
12•dpflan•30m ago•3 comments

Everything as Code: How We Manage Our Company in One Monorepo

https://www.kasava.dev/blog/everything-as-code-monorepo
29•benbeingbin•31m ago•9 comments

Show HN: Git-aware File tree viewer for Jupyter [video]

https://www.youtube.com/watch?v=zaK-EZd0GCY
1•loa_observer•31m ago•0 comments

Billionaire Superyachts in St. Barts for New Year's Eve

https://www.forbes.com/sites/jimdobson/2025/12/16/inside-the-billionaire-superyacht-rush-whos-cru...
2•walterbell•32m ago•0 comments

Show HN: Emergence (I asked Claude to impress me)

https://dwyer.co.za/static/claude.html
1•sixhobbits•33m ago•0 comments

Social Media Posts Predict Unemployment Spikes Two Weeks Early

https://scienceblog.com/social-media-posts-predict-unemployment-spikes-two-weeks-early/
4•geox•33m ago•0 comments

The sword-wielding man hired to kick squatters out of empty Oakland homes

https://oaklandside.org/2025/09/30/asap-squatter-removal-oakland/
1•randycupertino•34m ago•0 comments

Flock and Urban Surveillance

https://computer.rip/2025-12-26-Flock-and-Urban-Surveillance.html
2•kelnos•36m ago•0 comments

Soldr, an open-source compact soldering station

https://www.soldr.pro/
2•unwind•36m ago•0 comments