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

Fire at Dutch NorthC data center, all personnel evacuated in time

https://www.techzine.eu/news/infrastructure/141131/fire-at-northc-data-center-all-personnel-evacu...
1•notorandit•34s ago•1 comments

What do AI based layoffs say about their ability to scale?

https://www.elliotcsmith.com/what-do-ai-based-layoffs-say-about-tam/
2•smitec•2m ago•0 comments

How many of us are evaling our skills?

https://github.com/BintzGavin/apastra
2•GavinBintz•2m ago•0 comments

Attacking your competitors online is dumb

https://posthog.com/blog/why-attacking-competitors-is-dumb
3•herbertl•6m ago•0 comments

Reality emerges: What is the Universe made of?

https://aeon.co/essays/why-reality-is-more-than-the-sum-of-its-particles
2•herbertl•10m ago•0 comments

Ask HN: Are we observing the death of social networks?

2•fullstacking•10m ago•0 comments

thoughts on Gen AI's frontier of individuality

2•audreyfei•11m ago•0 comments

US trade court rules against Trump's 10% global tariffs

https://www.reuters.com/world/us-trade-court-rules-against-trumps-10-global-tariff-2026-05-07/
3•JumpCrisscross•13m ago•0 comments

Marc Andreessen Egg Game

https://marc-egg.eieio.games/
3•HotGarbage•13m ago•0 comments

Structured Procrastination

https://www.structuredprocrastination.com/
3•biscuits1•14m ago•1 comments

Ask HN: What will happen as AI costs increase?

2•MetaWhirledPeas•16m ago•0 comments

David Attenborough's 100 Years on Planet Earth

https://www.royalalberthall.com/tickets/events/2026/david-attenboroughs-100-years-on-planet-earth
2•smusamashah•16m ago•0 comments

cuda-oxide: a custom rustc backend for compiling GPU kernels in pure Rust

https://github.com/NVlabs/cuda-oxide
2•matt_d•17m ago•0 comments

Anthropic donates Petri open-source alignment tool

https://www.anthropic.com/research/donating-open-source-petri
2•dragonstyle•17m ago•0 comments

Qualcomm Hexagon V81 HMX Programmer's Reference Manual [pdf]

https://docs.qualcomm.com/doc/80-N2040-62/80-N2040-62_REV_AA_Qualcomm_Hexagon_V81_HMX_Programmers...
2•my123•22m ago•0 comments

Agent readability for the web (lightspeed benchmark for agents)

https://a14y.dev/
2•ghuntley•23m ago•0 comments

UK has wealthy Europe's '3rd-highest' rate of young adults not in work or study

https://www.theguardian.com/money/2026/apr/28/uk-has-wealthy-europes-third-highest-rate-of-18-to-...
2•PaulHoule•24m ago•0 comments

Cloudflare lays off 1,100 employees (~20% of workforce)

https://finance.yahoo.com/markets/stocks/articles/cloudflare-announces-first-quarter-2026-2015007...
16•gcr•25m ago•4 comments

Please Delete Your Repository

https://www.threads.com/@origsaeny/post/DYCBoN4CqOc
2•zane__chen•29m ago•0 comments

To the Surprise of No One, Cops Are Using ALPR Cameras to Stalk Their Exes

https://www.techdirt.com/2026/05/07/to-the-surprise-of-no-one-cops-are-using-alpr-cameras-to-stal...
3•cdrnsf•30m ago•0 comments

Ozempic Is Killing Off Weight Loss Surgeries. That's a Problem

https://gizmodo.com/ozempic-might-be-killing-off-weight-loss-surgeries-thats-a-problem-2000754277
2•paulpauper•30m ago•0 comments

Larql: Run attention locally, FFN on another machine

https://github.com/chrishayuk/larql
2•modinfo•34m ago•0 comments

Better than I thought FREE IQ Test

https://myiq.fyi/r/uf38d26
2•SteveChurch•34m ago•0 comments

The Perverse Tyranny of a Perfect Transcript

https://www.theatlantic.com/ideas/2026/05/harvard-grade-inflation-gpa/687074/
2•paulpauper•34m ago•0 comments

Free AI UK car shopping advice

https://regadvisor.co.uk/
2•buttertoast•34m ago•1 comments

Cloudflare to cut 20% jobs, quarterly revenue forecast falls short

https://www.reuters.com/business/world-at-work/cloudflare-cut-over-1100-jobs-2026-05-07/
6•symisc_devel•36m ago•3 comments

AI #167: The Prior Restraint Era Begins

https://thezvi.substack.com/p/ai-167-the-prior-restraint-era-begins
2•paulpauper•37m ago•0 comments

A case study with Aeneas and jxl-rs

https://jonathan.protzenko.fr/2026/05/05/jxl-rs.html
3•matt_d•37m ago•0 comments

Top universities hit after Canvas breach

https://www.techradar.com/pro/security/top-universities-among-victims-named-in-canvas-data-breach...
6•JustSkyfall•39m ago•0 comments

Brandolini's Law

https://en.wikipedia.org/wiki/Brandolini%27s_law
2•nvahalik•39m ago•0 comments