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

Wikipedia's most-read articles of 2025

https://wikimediafoundation.org/news/2025/12/02/announcing-wikipedias-most-read-articles-of-2025/
1•andsoitis•3m ago•0 comments

Thoughts on AI Progress

https://www.dwarkesh.com/p/thoughts-on-ai-progress-dec-2025
1•tfirst•6m ago•0 comments

A Directory of Every AI Tool for Hardware Engineers

https://www.hardwareai.directory
1•anu_bonth•7m ago•1 comments

Basecamp/Fizzy

https://github.com/basecamp/fizzy
1•doppp•9m ago•0 comments

Remove Attachments from Gmail Messages

https://attachments-extractor.ybouane.com/
1•michaelrkn•11m ago•1 comments

Built a tool which sizes and selects water filters

https://hydroanalyze.tech/
1•harishiitkgp7•18m ago•0 comments

Intrarectal perfluorodecalin for enteral ventilation in a first-in-human trial

https://www.cell.com/med/abstract/S2666-6340(25)00314-9
1•surprisetalk•18m ago•0 comments

Ambsheet: A spreadsheet for exploring scenarios [video]

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

Animalcules and Their Motors

https://www.asimov.press/p/flagella
1•surprisetalk•18m ago•0 comments

Planetary Robotics. Beyond Humanoids.

https://akash.earth/
1•maxnajer•19m ago•1 comments

Kohler Can Access Pictures from "End-to-End Encrypted" Toilet Camera

https://varlogsimon.leaflet.pub/3m6zrw6k2bs2p?interactionDrawer=quotes
13•TimDotC•24m ago•2 comments

Reverse-engineering Claude's sandbox, then building my own

https://michaellivs.com/blog/sandboxed-execution-environment
1•handfuloflight•27m ago•0 comments

Unpaid Labour in Productive Capacity

https://danieltan.weblog.lol/2025/12/appendix-b-unpaid-labour-in-productive-capacity
2•danieltanfh95•30m ago•0 comments

Is there anybody know the Open deep research modle:mirothinker

1•wuqiaocauc•30m ago•0 comments

UX Pilot's subscription defaults and refund process

1•haomiao33•33m ago•0 comments

Zillow deletes climate risk data from listings after complaints it harms sales

https://www.theguardian.com/environment/2025/dec/01/zillow-removes-climate-risk-data-home-listings
6•dredmorbius•39m ago•0 comments

The threats from AI are real – Sen. Bernie Sanders [video]

https://www.youtube.com/watch?v=K3qS345gAWI
3•timetraveller26•40m ago•0 comments

Open source tech interview assistant

https://github.com/claeusdev/prep-buddy
1•claeusdev•46m ago•0 comments

The strangest Excel functions you'll never use

https://www.makeuseof.com/strange-microsoft-excel-functions-no-one-ever-uses/
2•rfarley04•47m ago•0 comments

Composing capability security and conflict-free replicated data types

https://spritely.institute/news/composing-capability-security-and-conflict-free-replicated-data-t...
1•todsacerdoti•51m ago•0 comments

Iran court fines US $22B over Woman, Life, Freedom protests

https://www.iranintl.com/en/202512029239
2•pinewurst•57m ago•1 comments

Reversing IDA's Lumina Protocol

https://stack.int.mov/reversing-idas-lumina-protocol/
1•19h•59m ago•0 comments

China's Robot Training Factory: Where Humanoids Learn to Work

https://www.sixthtone.com/news/1017920
1•rguiscard•1h ago•0 comments

Ask HN: Why don't buildings have dry warm up rooms for your laptop in winter?

1•amichail•1h ago•8 comments

Google will start building data centers in space, powered by the sun, in 2027

https://www.businessinsider.com/google-project-suncatcher-sundar-pichai-data-centers-space-solar-...
4•cpeterso•1h ago•6 comments

Show HN: Cupertino – MCP server giving Claude offline Apple documentation

https://aleahim.com/blog/cupertino-ecosystem/
4•mihaela•1h ago•1 comments

Iranian MPs decry lack of observance of female dress code

https://www.newarab.com/news/iranian-mps-decry-lack-observance-female-dress-code
4•mhb•1h ago•1 comments

Francis Ford Coppola, Who Says He's 'Broke,' Is Selling a $1M Watch

https://www.nytimes.com/2025/10/23/fashion/francis-ford-coppola-watch-auction.html
1•handfuloflight•1h ago•1 comments

We Are Living in a Bifurcated Economy

https://amitsdeepdives.substack.com/p/we-are-living-in-a-bifurcated-economy
3•mhb•1h ago•0 comments

AI Needs to Feel Pain [video]

https://www.youtube.com/watch?v=fKf6Kl5TMc0
1•xqcgrek2•1h ago•1 comments