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?

Zedgerr – self-hosted invoicing and bookkeeping for freelancers

https://github.com/vMawk/Zedgerr
1•vMawk•1m ago•0 comments

Solving Open Research Problems Together

https://research.meta.ai/blog/solving-open-research-problems-together
1•o4c•3m ago•0 comments

Anthropic commits $100M to Claude Frontier Academy to train 10k FDEs by 2028

https://www.unite.ai/new-anthropic-academy-backs-10-000-engineer-residencies-with-100m/
2•thoughtpeddler•4m ago•0 comments

Show HN: Halo – Dynamic Island for macOS that also works on external monitors

https://halo-mac.vercel.app/
1•otabekabdiraimo•4m ago•0 comments

Former SR-71 Engineer Talks NASA's Blackbird Revival Program

https://www.twz.com/air/former-sr-71-engineer-talks-nasas-blackbird-revival-program
2•rkagerer•8m ago•0 comments

Turso Is Joining Supabase

https://turso.tech/blog/turso-is-joining-supabase
2•ElasticBottle•11m ago•0 comments

In One Year I Went from AI Skeptic to AI Pilled

https://openengine.cc/blog/ai-skeptic-to-ai-pilled/
1•dethstrobe•11m ago•0 comments

What would BASIC look like if it had never gone out of fashion?

https://thoreaubasic.com/
1•Gorsefound•11m ago•1 comments

Whistle: Speech to Text in 16.9 MB

https://cactuscompute.com/blog/whistle
1•yarapavan•13m ago•0 comments

New in Llama.cpp: Decision Models

https://huggingface.co/blog/ggml-org/decision-models-in-llamacpp
3•nreece•13m ago•0 comments

AI Effect

https://en.wikipedia.org/wiki/AI_effect
1•thunderbong•14m ago•0 comments

Apple changes full-disk access permissions to curb abuse from AI agents

https://arstechnica.com/security/2026/10/apple-changes-full-disk-access-permissions-to-curb-abuse...
1•joozio•22m ago•0 comments

Show HN: I turned 27 classic behavioral experiments into a browser game

https://twentyfun.com/games/mind-lab
1•yesman_x•22m ago•0 comments

Mark Zuckerberg Profile

https://colossus.com/article/mark-zuckerberg-profile/
3•davezatch•24m ago•0 comments

French supercomputer maker Bull doubles output to boost Europe's AI ambitions

https://www.reuters.com/world/europe/french-supercomputer-maker-bull-doubles-output-boost-europes...
2•giuliomagnifico•28m ago•0 comments

Ideabrowser meets dark mirror – mobile apps you can build today that are WTF

https://trix.wtf/ideas/
2•cs1996•32m ago•0 comments

Co-pilot on Flydubai flight was banned from flying by Oman for extremist views

https://www.france24.com/en/middle-east/20261003-co-pilot-on-flydubai-flight-was-banned-from-flyi...
3•Markoff•33m ago•2 comments

Understanding Frontier Artificial Intelligence

https://casp.ac/reports/intelligence-explosion
4•roversx•34m ago•0 comments

A Leap in GNU/Linux Usage, Japan's Share in Particular

https://techrights.org/n/2026/10/03/A_Leap_in_GNU_Linux_Usage_Japan_s_Share_in_Particular.shtml
4•amcclure•38m ago•0 comments

I got targeted: Trying to get your credentials via a Git post-checkout hook

https://frankwiles.com/posts/i-got-targeted/
2•tsak•39m ago•1 comments

Ukraine rolls out drone-stopping razor fence to thwart attacks

https://www.newscientist.com/article/2591491-ukraine-technology-thwarts-drones-by-cutting-their-c...
3•0in•41m ago•0 comments

Would you use Hive-simpler AI agents?

2•LeoBuildss•41m ago•0 comments

Mass Layoffs at Red Hat Not Limited to This Week or to Oct First

https://techrights.org/n/2026/10/02/The_Mass_Layoffs_at_Red_Hat_Secret_Layoffs_Not_Limited_to_Thi...
5•amcclure•42m ago•0 comments

System Design – How SSDs Work Internally

https://jzleetcode.github.io/posts/design-how-ssds-work-internally/
2•ankitg12•48m ago•0 comments

What I worry about with AI – Code Capsule

https://codecapsule.com/2026/09/03/what-i-worry-about-with-ai/
1•ankitg12•49m ago•0 comments

The College Decision Just Got Harder

https://www.theatlantic.com/ideas/2026/10/young-people-job-market-choice/688845/
1•littlexsparkee•49m ago•0 comments

Phylogeny, ontogeny and epigenesis: 3 sources of biological inspiration (1996)

https://link.springer.com/chapter/10.1007/3-540-63173-9_37
1•mellosouls•51m ago•0 comments

Without search, even the best AI models get 1 in 4 answers wrong

https://twitter.com/randal_olson/status/2105298222562582591
2•nreece•51m ago•0 comments

Extension to show how much of your email was typed

https://dobryn.in/typed/
1•ddbrx•1h ago•2 comments

Do high school students have to work harder nowadays?

https://statmodeling.stat.columbia.edu/2026/09/21/do-high-school-students-have-to-work-harder-now...
1•luu•1h ago•0 comments