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

The Gervais Principle, or the Office According to "The Office"

https://www.ribbonfarm.com/2009/10/07/the-gervais-principle-or-the-office-according-to-the-office/
1•janandonly•34s ago•0 comments

Show HN: Open Code Review – AI reviewers debate each other before feedback

https://github.com/spencermarx/open-code-review
1•spencermarx•59s ago•0 comments

Show HN: I built an AI social media summarizer to stop doomscrolling anxiety

https://www.somree.app
1•danielkrajka•1m ago•0 comments

Ask HN: 10-year dev, tried earning on the side for a year – lost $2,200

1•jianwei-x•1m ago•0 comments

My sentiment on AI, March 2026

https://www.carlos-menezes.com/posts/ai-sentiment-march-2026
1•carlos-menezes•4m ago•0 comments

Humanitarian crisis looming: 300k displaced as Israeli army pounds Lebanon

https://www.france24.com/en/humanitarian-crisis-looming-300-000-displaced-as-israeli-army-pounds-...
1•pera•8m ago•0 comments

Data Center Intelligence at the Price of a Laptop

https://tomtunguz.com/qwen-9b-matches-frontier-models/
1•vinhnx•9m ago•0 comments

Show HN: WebGPU Running a Swin Transformer

https://fungi.renderlab.cc
1•hirako2000•12m ago•0 comments

Americans' electricity bills are up. Don't blame AI

https://www.economist.com/finance-and-economics/2026/03/05/americans-electricity-bills-are-up-don...
1•pingou•13m ago•0 comments

Warmto.me Record a voice note after networking, AI writes your follow-up

https://www.warmto.me
1•aimoae•15m ago•1 comments

A Tour of Acme (2012)

https://research.swtch.com/acme
1•tosh•20m ago•0 comments

Jse v2.0 AI Output Specification

https://marchliu.github.io/2026/03/07/jse-v20-ai-output-specification
1•mars_liu•20m ago•0 comments

AI Angels – a platform for creating personalized AI companions

1•aiangels_24•20m ago•0 comments

I don't know if my job will still exist in ten years

https://www.seangoedecke.com/will-my-job-still-exist/
1•s_dev•21m ago•1 comments

Show HN: Ptero, a Svelte Alternative to Docusaurus

https://github.com/yail259/ptero
1•yaoke259•21m ago•0 comments

ma

http://www.call-with-current-continuation.org/ma/README
2•tosh•23m ago•0 comments

Show HN: SPF Flattener Solves the 10-Lookup Limit using recursive DNS resolution

https://spf1.com/
1•bwoud•23m ago•1 comments

Show HN: Visual drag-and-drop README builder with live GitHub preview

1•ofershapira•23m ago•0 comments

Show HN: MCP Starter Kit – Production-Ready TypeScript Template for MCP Serve

https://github.com/junna-legal/mcp-starter-kit
1•KJ_Labs•23m ago•0 comments

Sith Names and Darth Titles – Ultimate Dark Side Name Guide for Star Wars Fans

https://starwarsnamegenerator.com/blog/ultimate-sith-names-guide
1•Jaxon_Varr•25m ago•1 comments

Show HN: Anypost – P2P (group)chat with calls

https://anypost.xyz/
1•emilss•26m ago•0 comments

Show HN: I built Asterode, a multi model AI app with memory and power features

https://asterode.ai
2•stefbuzas•26m ago•1 comments

The $130/Month AI Agent Stack That Replaced a $200k Marketing Team

3•jackcofounder•26m ago•0 comments

UTF-8 History (2003)

https://www.cl.cam.ac.uk/~mgk25/ucs/utf-8-history.txt
1•tosh•27m ago•0 comments

Sarajevo Safari

https://en.wikipedia.org/wiki/Sarajevo_Safari
2•thunderbong•31m ago•0 comments

Specialization After Generalization: Towards Understanding Test-Time Training

https://arxiv.org/abs/2509.24510
1•teleforce•31m ago•0 comments

Capital Efficiency and the Tech Layoff Correction (2020-2025)

https://datakid.org/r/2026-03-07-jxhde2
1•tigerkid•33m ago•0 comments

Build an Agent That Learns from Its Own Mistakes [video]

https://www.youtube.com/watch?v=-stDHMwbBRw
1•malgamves•38m ago•0 comments

Filesystems Are Having a Moment

https://madalitso.me/notes/why-everyone-is-talking-about-filesystems/
2•malgamves•40m ago•0 comments

Show HN: Vimalender a Vim style calendar for the terminal written in Go

https://github.com/Sadoaz/vimalender
2•sadoaz•41m ago•0 comments