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•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?

AI's favorite coding language is also the most expensive

https://everythingengineer.substack.com/p/ais-favorite-coding-language-is-also
1•mikecarroll•9s ago•0 comments

Collective intelligence for AI-assisted chemical synthesis

https://www.nature.com/articles/s41586-026-10131-4
1•vednig•14s ago•0 comments

AI system fails during Glendale Community College graduation ceremony

https://www.azfamily.com/2026/05/19/ai-system-fails-during-glendale-community-college-graduation-...
1•Kapura•20s ago•0 comments

Elevated errors on Claude Opus 4.7

https://status.claude.com/incidents/f9yk8lqw384x
1•rob•1m ago•0 comments

The Not So Simple Task of Identifying Retail Trading Flow

https://medium.com/prooftrading/the-not-so-simple-task-of-identifying-retail-flow-a290c47944ba
1•smarkelon•1m ago•0 comments

Safetykit: A small collection of safety demos for human-in-the-loop scripts

https://thundergolfer.com/safetykit
1•thundergolfer•2m ago•0 comments

What's behind an unfindable feature for hotel management software?

https://littlelanguagemodels.com/but-its-right-there-on-the-website/
1•mooreds•2m ago•0 comments

Webb discovers one of the universe's first galaxies

https://phys.org/news/2026-05-webb-universe-galaxies.html
1•gmays•2m ago•0 comments

ICRA: We Turned iPhones into Spatial Data Capture Rigs

https://arxiv.org/abs/2605.05945
1•satpal•2m ago•0 comments

Dating Advice for Men

https://www.noahpinion.blog/p/dating-advice-for-men
1•mooreds•3m ago•0 comments

NATO Has Seen the Future and Is Unprepared

https://www.wsj.com/opinion/nato-has-seen-the-future-and-is-unprepared-887eaf0f
1•mooreds•4m ago•0 comments

Linux Foundation finds AI security readiness is now the top obstacle to adoption

https://thenewstack.io/ai-security-readiness-crisis/
1•CrankyBear•4m ago•0 comments

How Storm-2949 turned a compromised identity into a cloud-wide breach

https://www.microsoft.com/en-us/security/blog/2026/05/18/storm-2949-turned-compromised-identity-i...
2•el_duderino•5m ago•0 comments

Show HN: GobanFTP – a game of Go that lives in FTP listings

https://github.com/molang163/GobanFTP
1•molang163•5m ago•0 comments

Show HN: Design.md Taste Generator

https://aidesigntaste.com/
2•html5web•5m ago•0 comments

Claude Managed Agents on Cloudflare

https://blog.cloudflare.com/claude-managed-agents/
1•berlianta•6m ago•0 comments

Floats are dead Long live floats

https://www.silverorange.com/blog/float
1•speckx•6m ago•0 comments

Our Journey into Social Exile. X, Threads, Reddit and LinkedIn Ban

https://negativestarinnovators.com/blog/our-journey-into-social-exile
2•pizzly•9m ago•2 comments

Show HN: Guitar Guru – A guitar valuation app using ML

https://apps.apple.com/us/app/guitar-guru/id6761500318
1•shatnersbassoon•9m ago•0 comments

Why is almost everyone right-handed?

https://www.ox.ac.uk/news/2026-05-15-why-is-almost-everyone-right-handed-the-answer-may-lie-in-ho...
1•gmays•10m ago•0 comments

Show HN: Efficient Modeling of Nonlinear Dynamics in Nonstationary Data Streams

https://github.com/C-Naoki/AdaKoop
1•C-Naoki•11m ago•0 comments

Licensing Personal Projects

https://blog.ty-porter.dev/development/video%20games/2026/05/18/licensing-personal-projects.html
1•speckx•12m ago•0 comments

Ur Dream Founding Engr?

1•Kunal1522•12m ago•1 comments

The Stack Behind Clicky

https://twitter.com/julesrosenberg/status/2056747461931348438
3•juliarosenberg•13m ago•1 comments

Writes and Write-Nots

https://www.paulgraham.com/writes.html
1•duc_minh•14m ago•0 comments

The Billionaire Who Wired San Francisco

https://nymag.com/intelligencer/article/chris-larsen-san-francisco-cameras-surveillance.html
2•littlexsparkee•15m ago•0 comments

Tristan Davey's Punch Card Archive

https://punchcards.tristandavey.com/
1•ohjeez•21m ago•0 comments

Show HN: CLI Security for Agentic Development

https://github.com/marco-trotta1/badvibes
1•muoco-01•22m ago•0 comments

New Surface devices built for business and AI acceleration

https://blogs.windows.com/devices/2026/05/19/introducing-new-surface-devices-built-for-business-a...
1•ericsaf•22m ago•0 comments

Show HN: Nexus – free, self-hosted business suite for service teams

https://nexus-erp.de
2•at2software•23m ago•1 comments