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?

Building a High-Performance OpenAPI Parser in Go

https://www.speakeasy.com/blog/building-speakeasy-openapi-go-library
1•indybonez•4m ago•1 comments

Rivian's Gen3 Processor [video]

https://www.youtube.com/watch?v=cu0_ZEIT5YU
1•kappi•5m ago•0 comments

Claude CLI deleted my home directory Wiped my whole Mac

https://old.reddit.com/r/ClaudeAI/comments/1pgxckk/claude_cli_deleted_my_entire_home_directory_wi...
17•tamnd•13m ago•4 comments

What a top food safety expert won't order for dinner

https://www.washingtonpost.com/business/2025/12/14/foodborne-illness-safety-expert-advice/
3•bookofjoe•18m ago•3 comments

Last Call for Mass Market Paperbacks

https://www.publishersweekly.com/pw/by-topic/industry-news/publisher-news/article/99293-last-call...
1•dsr_•20m ago•0 comments

DARPA GO: Generative Optogenetics

https://www.darpa.mil/research/programs/go
1•birriel•23m ago•0 comments

Rive in React Native – The Good, the Bad and the Janky

https://justanotherheroriding.github.io/portfolio/writing/rive-react-native
1•justAnotherHero•26m ago•1 comments

British Rail Sandwich (Wikipedia)

https://en.wikipedia.org/wiki/British_Rail_sandwich
1•valzevul•28m ago•0 comments

Ask HN: Can someone explain why Meta makes such bad design decisions?

3•Desafinado•30m ago•0 comments

The Eerie Parallels Between AI Mania and the Dot-Com Bubble

https://www.wsj.com/finance/stocks/the-eerie-parallels-between-ai-mania-and-the-dot-com-bubble-f9...
1•JumpCrisscross•31m ago•0 comments

SpaceX Starts a Wall Street Bake-Off to Hire Banks for Possible IPO

https://www.wsj.com/finance/banking/spacex-starts-a-wall-street-bake-off-to-hire-banks-for-possib...
2•JumpCrisscross•31m ago•0 comments

Neuroevolution of Augmenting Topologies in JavaScript

https://github.com/joshuadam/NEAT-JavaScript
1•joshuadam•33m ago•1 comments

Ask HN: Is starting a personal blog still worth it in the age of AI?

4•nazarh•34m ago•3 comments

JavaScript Engine Security in 2025 [pdf]

https://saelo.github.io/presentations/poc_25_js_engine_security_in_2025.pdf
1•akyuu•37m ago•0 comments

Discover the best websites you've never heard about

https://viralwalk.com/
1•gnabgib•39m ago•0 comments

Evalite: Evaluate your LLM-powered apps with TypeScript

https://github.com/mattpocock/evalite
1•handfuloflight•41m ago•0 comments

Show HN: Gradient.bg – Aesthetic Gradient Generator

https://gradient.bg
1•floships•41m ago•1 comments

Show HN: I vibe coded a vibe marketing platform

https://postking.app
1•ditegashi•41m ago•0 comments

CCTV appeal after museum artefacts stolen (in UK)

https://www.avonandsomerset.police.uk/news/2025/12/cctv-appeal-after-museum-artefacts-stolen/
1•gnabgib•43m ago•0 comments

UEmacs/PK 4.0: Full screen editor based on MicroEMACS 3.9e

https://github.com/torvalds/uemacs
1•doener•44m ago•0 comments

Musk's Last Grift

https://crookedtimber.org/2025/11/22/musks-last-grift/
4•stareatgoats•45m ago•2 comments

Nokia: The Deep Fall of an Industry Giant – The Rise and Fall of Nokia Mobile [video]

https://www.youtube.com/watch?v=_1t15PNb468
1•type0•49m ago•0 comments

History of Declarative Programming

https://shenlanguage.org/TBoS/tbos_15.html
3•measurablefunc•50m ago•0 comments

Trying out KOReader and Wallabag (the first few days and months)

https://planet.kde.org/matija-suklje-hook-2025-05-24-trying-out-koreader-and-wallabag-the-first-f...
2•Curiositry•53m ago•0 comments

Where Is GPT in the Chomsky Hierarchy?

https://fi-le.net/chomsky/
1•fi-le•59m ago•0 comments

Show HN: Add keyboard shortcuts to any site with a browser extension

https://github.com/one-with-violets-in-her-lap/bind
1•sleep678765•1h ago•0 comments

OpenAI Ends 'Vesting Cliff' for New Employees in Compensation-Policy Change

https://www.wsj.com/tech/ai/openai-ends-vesting-cliff-for-new-employees-in-compensation-policy-ch...
1•divbzero•1h ago•0 comments

Rat Dystopia

https://demystifysci.com/blog/2020/7/22/rat-dystopia
2•certyfreak•1h ago•0 comments

BA fears a future where AI agents pick flights and brands get ghosted

https://www.theregister.com/2025/12/13/british_airways_fears_a_future/
6•zeristor•1h ago•0 comments

Sloot Digital Coding System

https://en.wikipedia.org/wiki/Sloot_Digital_Coding_System
1•rmason•1h ago•0 comments