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•11mo 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•11mo 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•11mo 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•11mo 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•11mo ago
Load test against a clone instead of a DB whose contents you care about?

Ask HN: What Is the Big-O Order of a Jigsaw Puzzle?

1•AnimalMuppet•2m ago•0 comments

Show HN: DynamoSQL – I made a SQL query engine for DynamoDB

https://dynamosql.com/
1•cammasmith•2m ago•0 comments

Forensic analysis of 37GB data loss caused by Cursor AI Agent

https://github.com/kotarimorm/-Report-AI-coding-agent-programmatically-bypassing-OS-security-poli...
1•GRAY_WHALE_CO•4m ago•0 comments

A sleek, wearable airbag for cyclists is nearly here

https://www.theverge.com/gadgets/911540/a-sleek-wearable-airbag-for-cyclists-is-nearly-here
1•JeanKage•4m ago•0 comments

Dual-Boot an Apple Silicon Mac in Sequoia or Tahoe

https://eclecticlight.co/2026/04/14/dual-boot-an-apple-silicon-mac-in-sequoia-or-tahoe/
1•chmaynard•4m ago•0 comments

Cloudflare Incident – Increased HTTP 5xx Errors

https://www.cloudflarestatus.com/incidents/213v4v7s7m97
1•palmeida•5m ago•0 comments

Dermcidin has antiviral activity and protects against influenza

https://www.pnas.org/doi/10.1073/pnas.2424461123
1•geox•5m ago•0 comments

Show HN: Hotel MCP server for cash and points search/booking (free)

https://www.gondola.ai/mcp
1•skyler1537•7m ago•0 comments

Can you pass the reverse Turing test?

https://nataliercargill.substack.com/p/can-you-pass-the-reverse-turing-test
1•eatitraw•8m ago•0 comments

Man suspected of Molotov attack Sam Altmans home charged with attempted murder

https://www.theregister.com/2026/04/14/altman_attempted_murder/
1•Bender•9m ago•0 comments

Linux 7.0 debuts as Linus Torvalds ponders AI's bug-finding powers

https://www.theregister.com/2026/04/13/linux_kernel_7_releaseed/
2•Bender•10m ago•0 comments

Measles takes a plane to Idaho, which has worst vaccination rate in US

https://arstechnica.com/health/2026/04/airport-measles-case-reported-in-idaho-state-with-lowest-v...
3•Bender•11m ago•0 comments

My First Fight

https://dschorno.wordpress.com/2026/04/10/my-first-fight/
1•eatitraw•14m ago•0 comments

Surf

https://about.surf.social/
1•bookofjoe•18m ago•0 comments

Show HN: Manex Hub – private AI research memory, on-device

https://manex.app/
2•krcnow•19m ago•0 comments

Show HN: Get Hired with AI, a free book I wrote on using LLMs for a job search

https://www.careervectorhq.com/book/get-hired-with-ai.html
1•dawie•19m ago•1 comments

Time for Scrutiny: Getting to the Bottom of Daylight Saving Time and Time Zones

https://fixdst.com/?rdt_cid=5846299599488362810
1•surprisetalk•19m ago•0 comments

JSON-complete data formats and programming languages

https://lemire.me/blog/2025/12/20/json-complete-data-format-and-programming-languages/
1•surprisetalk•19m ago•0 comments

Noise

https://homosabiens.substack.com/p/noise
1•surprisetalk•19m ago•0 comments

Which of these two arcades is the "world largest"

https://arstechnica.com/gaming/2026/03/which-of-these-two-arcades-is-the-world-largest-and-does-i...
1•surprisetalk•19m ago•1 comments

Tracking takedown notices filed by UK Biobank

https://biobank.rocher.lc
1•Cynddl•21m ago•0 comments

Stanford HAI Index Report 2026

https://hai.stanford.edu/ai-index/2026-ai-index-report
1•giuliomagnifico•22m ago•0 comments

Durable Objects in Dynamic Workers: Give each AI-generated app its own database

https://blog.cloudflare.com/durable-object-facets-dynamic-workers/
1•TheTaytay•22m ago•0 comments

MCP – It's Hot, but Will It Win? (2025)

https://hardcoresoftware.learningbyshipping.com/p/230-mcp-its-hot-but-will-it-win
2•tosh•24m ago•0 comments

Comad World v0.3.0 – your reading compounds into your tools

https://github.com/kinkos1234/comad-world
1•comadj•24m ago•0 comments

OpenAI Introduction (2015)

https://openai.com/index/introducing-openai/
1•downbad_•26m ago•1 comments

Colossal Pressure: Russia targets university students for military recruitment

https://www.cnn.com/2026/04/14/europe/russia-students-military-recruitment-campaign-intl-cmd
3•breve•26m ago•0 comments

CorePage: I built an AI start page to replace my tabs (notes, news, tools, chat)

https://corepage.ai/
1•devrimco•27m ago•1 comments

Moats Don't Work When Bridges Are Free

https://www.dustinalper.com/blog/bridges-are-free
3•dalps•27m ago•1 comments

Completion is a Substrate, not a UI

https://www.chiply.dev/post-icr-primer
1•chiply•28m ago•0 comments