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

My AI Adoption Journey

https://mitchellh.com/writing/my-ai-adoption-journey
1•anurag•1m ago•0 comments

Flock CEO calls Deflock a "terrorist organization" [video]

https://www.youtube.com/watch?v=l-kZGrDz7PU
1•cdrnsf•1m ago•0 comments

Show HN: Playwright Best Practices AI SKill

https://github.com/currents-dev/playwright-best-practices-skill
1•waltergalvao•4m ago•0 comments

Ask HN: I built a time-travel debugger for AI agents

1•ishantkohar•4m ago•0 comments

The Accelerator and the Brake

https://blog.sebastiansastre.co/posts/the-accelerator-and-the-brake/
1•sebastianconcpt•5m ago•0 comments

Automated face redaction in Epstein files redacts Mona Lisa

https://bsky.app/profile/wyattprivilege.bsky.social/post/3me4y7goih222
1•m-hodges•5m ago•1 comments

Toyota's working on better EV Battery placement

https://www.caranddriver.com/news/a70214829/toyota-ev-battery-layout-patent-details/
2•RickJWagner•6m ago•0 comments

Torx Plus: The High-Tech Screw Hiding in Our Gadgets

https://www.ifixit.com/News/110702/torx-plus-the-high-tech-screw-hiding-in-our-gadgets
1•nico401•7m ago•0 comments

Rewriting Pycparser with the Help of an LLM

https://eli.thegreenplace.net/2026/rewriting-pycparser-with-the-help-of-an-llm/
1•ibobev•8m ago•0 comments

I got tired of Moltbook, so I launched flowbook

https://flowbook.dev/
1•theyogadev•8m ago•1 comments

We (Basically) Stopped Writing Prompts. Here's What We Do Instead.

https://macroscope.com/blog/we-stopped-writing-prompts
2•curiouska•11m ago•0 comments

Why my "metric-free" social network failed and became a toxic void

1•mekod•12m ago•0 comments

Notes on Space GPUs

https://www.dwarkesh.com/p/notes-on-space-gpus
2•emschwartz•14m ago•1 comments

AI found 12 of 12 OpenSSL zero-days

https://www.lesswrong.com/posts/7aJwgbMEiKq5egQbd/ai-found-12-of-12-openssl-zero-days-while-curl-...
1•greedo•16m ago•1 comments

ClickHouse makes Top-N queries faster with granule-level data skipping

https://clickhouse.com/blog/clickhouse-top-n-queries-granule-level-data-skipping
1•samaysharma•16m ago•0 comments

Software Projects Will Be Late

https://aethermug.com/posts/software-projects-will-be-late
1•speckx•16m ago•0 comments

Microgravity-induced constraints on melanin bioproduction aboard the ISS

https://www.nature.com/articles/s41526-026-00560-w
1•PaulHoule•17m ago•0 comments

Show HN: HyperAgency (H9y.ai) – Open-Source Agentic AI Operating System

https://github.com/vuics/h9y
1•alphara•17m ago•1 comments

Tab-it – Smart Chrome tab organization with session management

https://chromewebstore.google.com/detail/tab-it/ibjlmaiklkfchnggbjlkhjaafchmfcnb
1•choic•18m ago•1 comments

Ask HN: Is it AGI for software engineering?

3•colesantiago•20m ago•4 comments

Show HN: Mjmx – JSX Runtime for Mjml

https://github.com/skwee357/mjmx
1•skwee357•20m ago•0 comments

High performance correctly rounded math libraries for 32-bit floating point

https://blog.sigplan.org/2021/08/26/high-performance-correctly-rounded-math-libraries-for-32-bit-...
2•fanf2•24m ago•0 comments

The Absence of No Is Not Yes: Italy's Flawed Sexual Violence Bill

https://www.hrw.org/news/2026/01/27/the-absence-of-no-is-not-yes-italys-flawed-sexual-violence-bill
2•binning•27m ago•0 comments

Alice Augusta Ball, chemist who made the first effective treatment for leprosy

https://en.wikipedia.org/wiki/Alice_Ball
2•binning•29m ago•0 comments

Show HN: Yeehaw – Infrastructure as Farm

https://github.com/Colmbus72/yeehaw
1•camcamcam•29m ago•0 comments

Show HN: Track vim cmd and mapping usage, and detect typos to optimize vimrc

https://github.com/AquiGorka/vim-stats
1•AquiGorka•30m ago•0 comments

Japanese city cancels cherry blossom festival over badly behaved tourists

https://www.bbc.com/news/articles/c1wzrlndzjro
4•tartoran•30m ago•0 comments

Date Arithmetic in Bash

https://blog.miguelgrinberg.com/post/date-arithmetic-in-bash
3•ibobev•31m ago•1 comments

Programming Your Own Modern BBS with Python

https://retrogamecoders.com/programming-bbs-with-python/
2•ibobev•31m ago•0 comments

ONNX Based Generative AI LLMs in Java with Project Babylon by Adam Sotona [video]

https://www.youtube.com/watch?v=fJwKvE2AxIo
1•zikani_03•32m ago•0 comments