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?

Mental Shortcuts and Sensible Defaults

https://rojoroboto.com/newsletter/weekly-reflection-002
1•mooreds•4m ago•0 comments

Decenterlized Login System for a Media Server Project?

1•vxsz•7m ago•1 comments

The Era of Visual Studio Code (2020)

https://blog.robenkleene.com/2020/09/21/the-era-of-visual-studio-code/
1•handfuloflight•7m ago•1 comments

Workday project at Washington University hits $266M

https://www.theregister.com/2025/12/12/washington_university_workday_costs_revealed/
2•sebastian_z•16m ago•0 comments

Myna v2.0: contextual variants, more weights (and even supports APL)

https://github.com/sayyadirfanali/Myna/releases/tag/v2.0.0
2•todsacerdoti•18m ago•0 comments

Safari 26.2 Release Notes

https://developer.apple.com/documentation/safari-release-notes/safari-26_2-release-notes
1•ksec•18m ago•0 comments

Chrome Extension Manager

https://chromewebstore.google.com/detail/extension-manager-extensi/jafcieombbedhpdkjlhcggagepcgaihp
1•kaporalix•19m ago•1 comments

China's trade surplus tops record US$1T, defying trade war uncertainty

https://www.scmp.com/economy/economic-indicators/article/3335551/chinas-exports-rebound-november-...
4•ksec•19m ago•0 comments

Purdue University Approves New AI Requirement for All Undergrads

https://www.forbes.com/sites/michaeltnietzel/2025/12/13/purdue-university-approves-new-ai-require...
2•rmason•21m ago•0 comments

The rise and fall of Subway: The $11 billion empire that crumbled

https://www.youtube.com/watch?v=LeF6DG7xfpA
1•paulpauper•21m ago•0 comments

Human Agency: Protect your documents with hidden Anti AI directives

https://www.human-agency.xyz/
1•merinid•22m ago•1 comments

Sovereignty by Disruption: The Rise of Corporate Quasi-States

https://www.vinniefalco.com/p/synthetic-agency-displacement-disorder
2•hakilebara•22m ago•1 comments

PaperTrails: Your Personal Research Library

https://www.papertrailshq.com/
1•mhb•24m ago•1 comments

Ancient lake that vanished 100k years ago returns to California

https://www.dailymail.co.uk/sciencetech/article-15380617/lake-vanished-RETURNS-California-record-...
2•Bender•27m ago•0 comments

Want to sway an election? Here’s how much fake online accounts cost

https://www.science.org/content/article/want-sway-election-here-s-how-much-fake-online-accounts-cost
11•rbanffy•27m ago•0 comments

Reproducibility Test-Time Training on Nearest Neighbors for LLMs

https://arxiv.org/abs/2511.16691
1•PaulHoule•33m ago•0 comments

Australian teens were kicked off social media this week. Some are back already

https://www.cnn.com/2025/12/12/australia/australia-social-media-kids-intl-hnk-dst
3•Bender•35m ago•0 comments

RAMageddon is finally coming for your smartphones and laptops

https://www.tomsguide.com/computing/laptops/worsening-ram-crisis-starting-to-impact-smartphones-a...
4•elorant•36m ago•0 comments

More atmospheric rivers coming for flooded Washington and the West Coast

https://www.cnn.com/2025/12/12/weather/washington-west-coast-flooding-atmospheric-rivers-climate
2•Bender•37m ago•0 comments

Before You Cite That Study

https://eleganthack.com/before-you-cite-that-study/
2•adrianhoward•37m ago•1 comments

What happens when the coding becomes the least interesting part of the work

https://obie.medium.com/what-happens-when-the-coding-becomes-the-least-interesting-part-of-the-wo...
1•enraged_camel•40m ago•0 comments

A brief natural history of misinformation

https://royalsocietypublishing.org/rsif/article/22/233/20250161/364004/A-brief-natural-history-of...
1•geox•41m ago•0 comments

Enabling small language models to solve complex reasoning tasks

https://news.mit.edu/2025/enabling-small-language-models-solve-complex-reasoning-tasks-1212
2•LiveTheDream•42m ago•0 comments

Benchmarking LLMs on whether they can play FizzBuzz

https://github.com/venkatasg/fizzbuzz-llm
1•_venkatasg•43m ago•0 comments

Why Twilio Segment Moved from Microservices Back to a Monolith

https://www.twilio.com/en-us/blog/developers/best-practices/goodbye-microservices
2•birdculture•45m ago•0 comments

Faster Double-to-String Conversion

https://vitaut.net/posts/2025/faster-dtoa/
1•todsacerdoti•50m ago•0 comments

JD Vance: "You might try hiring Americans."

https://twitter.com/JDVance/status/1999880386898252030
8•SilverElfin•53m ago•16 comments

I fed 24 years of my blog posts to a Markov model

https://susam.net/fed-24-years-of-posts-to-markov-model.html
8•zdw•55m ago•1 comments

The Rise of Computer Games, Part I: Adventure

https://technicshistory.com/2025/12/13/the-rise-of-computer-games-part-i-adventure/
2•cfmcdonald•56m ago•0 comments

Texas Space Boom Requires Lots of Lawyers in Boost for Firms

https://news.bloomberglaw.com/business-and-practice/texas-space-boom-requires-lots-of-lawyers-in-...
2•mooreds•1h ago•0 comments