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?

Show HN: A Werewolf-style puzzle with zero lying

https://www.cluesofwho.com/
1•soasme•56s ago•0 comments

Apple will not let me join the Developer Program – and will not say why

https://yomuapp.kulman.sk/support
1•tectiv3•2m ago•0 comments

PeerTube V8: manage your videos with your team

https://framablog.org/2025/12/09/peertube-v8-manage-your-videos-with-your-team/
2•tcit•3m ago•0 comments

Whitehall rejects £1.8B digital ID price tag – but won't say what it will cost

https://www.theregister.com/2025/12/09/uk_digital_id_costs/
1•jjgreen•3m ago•0 comments

Compiler Engineering in Practice – Part 1: What Is a Compiler?

https://chisophugis.github.io/2025/12/08/compiler-engineering-in-practice-part-1-what-is-a-compil...
1•todsacerdoti•4m ago•0 comments

OpenAI paused a focus on AGI for 8 weeks to quickly improve ChatGPT

https://www.wsj.com/tech/ai/openai-sam-altman-google-code-red-c3a312ad
1•Hyeonjong•5m ago•0 comments

DynamoDB: Resilience and lessons from the Oct 2025 service disruption

https://www.youtube.com/watch?v=YZUNNzLDWb8
1•belter•7m ago•0 comments

The Joel Test: 12 Steps to Better Code (2000)

https://www.joelonsoftware.com/2000/08/09/the-joel-test-12-steps-to-better-code/
1•tamnd•8m ago•0 comments

Velocity-Bridge: Copy on iPhone. Paste on Linux. No Cloud, No macOS Required

https://github.com/Trex099/Velocity-Bridge
1•thunderbong•11m ago•0 comments

Nano Banana

https://imgeditor.co/
1•bellamoon544•12m ago•1 comments

The Joy of Playing Grandia, on Sega Saturn

https://www.segasaturnshiro.com/2025/11/27/the-joy-of-playing-grandia-on-sega-saturn/
3•tosh•13m ago•1 comments

What Is a Codec and Why Is It Important for Video Streaming?

https://www.red5.net/blog/what-is-a-codec/
1•mondainx•17m ago•0 comments

SGML Syntax Reference

http://sgmljs.sgml.net/docs/sgmlrefman.html
1•fanf2•19m ago•0 comments

UN environment report 'hijacked' by US and others over fossil fuels

https://www.bbc.com/news/articles/c1w9ge93w9po
1•defrost•23m ago•0 comments

Embracing the Improbable

https://kevinkelly.substack.com/p/embracing-the-improbable
1•thm•26m ago•0 comments

The 70-20-10 growth formula that’s speeding up career success

https://www.indiatoday.in/education-today/jobs-and-careers/story/the-70-20-10-growth-formula-that...
1•rustoo•32m ago•0 comments

Factor 0.101 Now Available

https://re.factorcode.org/2025/12/factor-0-101-now-available.html
1•todsacerdoti•34m ago•0 comments

It's not censorship. It's democratic self-defense

https://civiceconomist.substack.com/p/its-not-censorship-its-democratic
4•ggirelli•34m ago•0 comments

Stop asking AI to write code

https://bsky.app/profile/beddel.bsky.social/post/3m7juvz7hwc25
1•mesenga•39m ago•1 comments

Show HN: Repack AI – Turn Any Article/Video URL into 10 Social Content Pieces

https://repackai.co/
2•azureray•41m ago•3 comments

Show HN: Arc – Android overlay to run custom AI prompts on any app

https://play.google.com/store/apps/details?id=com.rethink.arc&hl=en_US
1•rethink-hub•41m ago•0 comments

Show HN: A deterministic code-rewrite engine that learns from one example

1•heavymemory•43m ago•0 comments

Zero Lines of code. 1 AI prompt. 1 deployed website

https://github.com/cloudflare/vibesdk
1•bakigul•43m ago•0 comments

Campus Characters: Identical twins, the Byers, live identical lives (2014)

https://thedailytexan.com/2014/03/31/campus-characters-identical-twins-the-byers-live-identical-l...
1•TMWNN•44m ago•0 comments

EU launches antitrust probe into Google's use of online content for AI purposes

https://ec.europa.eu/commission/presscorner/detail/en/ip_25_2964
8•skilled•44m ago•1 comments

Show HN: A deterministic code-rewrite engine that learns from one example

1•hypmachine•45m ago•0 comments

30 Year Anniversary of WarCraft II: Tides of Darkness

https://www.jorsys.org/archive/december_2025.html#newsitem_2025-12-09T07:42:19Z
2•sjoblomj•48m ago•0 comments

Show HN: I built a website that runs itself. Roast my AI-generated content

https://www.stvck.dev
2•since•49m ago•2 comments

Stack Overflow: Challenge #14 Signal from Noise

https://stackoverflow.com/beta/challenges/79838396/challenge-14-signal-from-noise
1•signa11•50m ago•0 comments

Plead guilty to laptop farm and ID theft scheme to land N. Koreans US IT jobs

https://arstechnica.com/security/2025/11/5-plead-guilty-to-laptop-farm-and-id-theft-scheme-to-lan...
2•PaulHoule•51m ago•0 comments