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?

Open Source as a Research Method

https://lemire.me/blog/2026/11/04/open-source-as-a-research-method/
1•smilelamp•3m ago•0 comments

French Leave

https://en.wikipedia.org/wiki/French_leave
1•shahargl•3m ago•0 comments

Redis now has compressed bitmaps (Roaring)

https://lemire.me/blog/2026/10/15/redis-now-has-compressed-bitmaps-roaring/
1•surprisetalk•5m ago•0 comments

I got banned from Lobsters for writing like an LLM

https://en.andros.dev/blog/94a77341/i-got-banned-from-lobsters-for-writing-like-an-llm/
2•andros•6m ago•0 comments

Show HN: TerminalLynx – Cloud-like SSH device and team sync, without the cloud

https://terminallynx.com/
1•derekleeth•7m ago•0 comments

WikiAnesthesia: Airway Fire

https://wikianesthesia.org/wiki/Airway_fire
1•gregsadetsky•8m ago•0 comments

Aizome: Sekka's Own Desktop

https://sekka.computer/aizome/
1•evacchi•8m ago•0 comments

Kontext vs. GoHighLevel: an all-in-one CRM, or a CRM plus the product

https://kontext.network/journal/@muggzie1/kontext-as-a-service/compare-kontext-vs-gohighlevel
1•JasonMugg•9m ago•0 comments

Block training, keep answers? What 13,938 sites ask of AI bots

https://trakis.io/research/block-training-keep-answers
1•researchaiexe•9m ago•0 comments

Microsoft Files Patent to Rewrite What Speakers Say in Live Video

https://patentlyze.com/patent/microsoft-live-ai-video-rewrites-speech/
1•samch•9m ago•0 comments

MSI XpertStation WS300 Review Nvidia DGX Station GB300

https://www.servethehome.com/msi-xpertstation-ws300-review-nvidia-dgx-station-gb300/
1•teleforce•11m ago•0 comments

Phone-only support leaves some disabled people out

https://nicolas-steenhout.com/phone-only-support-excludes/
1•robin_reala•11m ago•0 comments

Show HN: KiviDB 1.2.0 is out and it is faster now [video]

https://www.youtube.com/watch?v=kl1Jfgdli70
1•murtazayusuf•12m ago•0 comments

Server Side Includes with Cloudflare Workers

https://github.com/artps/ssi
1•jonatron•13m ago•0 comments

Show HN: Agent-roast – send your coding agent back when it weakens a test

https://github.com/Nari-Ab/agent-roast
1•Nari_Ab•15m ago•0 comments

Show HN: Gradevibes-Is your AI-written app finished?

https://gradevibes.com/?tab=upload
1•Richaan36•16m ago•0 comments

Show HN: Screenshot to Tokens – give a web app a design system from a screenshot

https://github.com/nhunsaker/screenshot-to-tokens
1•nobrien•16m ago•0 comments

Read Less Hacker News. Learn More

https://hackerbyte.net/
1•bakigul•19m ago•0 comments

EdgeDAE: Acceleration of Diffusion Action Experts for Real-Time Physical AI

https://arxiv.org/abs/2610.00311
1•teleforce•19m ago•0 comments

Water Leaking from Upstairs Bathroom to Downstairs Ceiling? What to Do

https://waterdamagerestorationneworleansla.com/upstairs-bathroom-leaking-through-ceiling/
1•electricianjame•19m ago•0 comments

Disaster is still better than AI

https://jasonpolak.substack.com/p/disaster-is-still-better-than-ai
2•bemtevi•20m ago•0 comments

TokenEconomizer: Cut coding-agent token costs 18-31%

https://github.com/microsoft/TokenEconomizer
2•mehdizare•20m ago•1 comments

Show HN: Backup your ChatGPT and Claude conversation free

https://www.samewindow.com/
2•gsngsn•21m ago•0 comments

From Lotus Leaves to Rain Jackets: The Power of Biomimicry

https://www.mcgill.ca/oss/article/student-contributors-technology-general-science/lotus-leaves-ra...
1•bookofjoe•23m ago•0 comments

Choir on Adult Swim – Do you remember this one?

https://www.adultswim.com/etcetera/choir
1•francescobonomi•23m ago•1 comments

Kontext vs. Lovable: an app builder, or the business around the app

https://kontext.network/journal/@muggzie1/kontext-as-a-service/compare-kontext-vs-lovable
2•JasonMugg•23m ago•0 comments

Fruit Trenches: Cultivating Subtropical Plants in Freezing Temperatures (2020)

https://solar.lowtechmagazine.com/2020/04/fruit-trenches-cultivating-subtropical-plants-in-freezi...
2•zenincognito•25m ago•0 comments

Where Claude's usage limits went: from SSE to protobuf frames

https://claude-monitor.com/claude-usage-limits-sse-to-protobuf
1•claudeusage•25m ago•0 comments

New Bodies, Unconventional Minds: a continuum of cognition (& consciousness) [video]

https://www.youtube.com/watch?v=YxmSCElKdm0
1•surprisetalk•25m ago•0 comments

'There Is One Fight': American Voters Reject Tech Oligarchy

https://www.404media.co/there-is-one-fight-american-voters-reject-tech-oligarchy/
4•cdrnsf•26m ago•0 comments