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

Sell America is the new trade on Wall Street

https://www.nytimes.com/2026/01/31/business/sell-america-dollar-financial-markets.html
2•softwaredoug•2m ago•0 comments

I guess I'm AI-pilled now?

https://brittanyellich.com/i-guess-im-ai-pilled-now/
2•mooreds•3m ago•0 comments

Show HN: Envware – E2EE CLI to manage environment variables across devices

2•humbertocruz•5m ago•0 comments

Launching My Side Project as a Solo Dev: The Walkthrough

https://alt-romes.github.io/posts/2026-01-30-from-side-project-to-kickstarter-a-walkthrough.html
2•romes•6m ago•0 comments

Do you really know your position?

https://agrisacademy.com/do-you-really-know-your-position/
1•mooreds•7m ago•0 comments

Show HN: Envware – E2EE CLI to manage environment variables across devices

https://www.envware.dev
1•humbertocruz•7m ago•0 comments

LazyVim for Ambitious Developers

https://lazyvim-ambitious-devs.phillips.codes/course/chapter-1/
1•Townley•7m ago•0 comments

Moltbook: Early Evidence of Agent-Targeted Influence Mechanics

https://medium.com/technomancy-laboratories/compressed-alignment-attack-early-evidence-of-agent-t...
1•pstryder•11m ago•0 comments

The Inverted Panopticon

https://shanakaanslemperera.substack.com/p/the-inverted-panopticon
1•MassPikeMike•12m ago•0 comments

Kling 3 – Cinematic AI video generator with character consistency

https://kling3.app/
1•Jenny249•14m ago•0 comments

GNU Recutils: a database management system using human-readable text files

https://labs.tomasino.org/gnu-recutils/
1•fanf2•15m ago•0 comments

Agent Consent Protocol (ACP)

https://github.com/o1100/Agent-Consent-Protocol
1•mooreds•18m ago•0 comments

Icons That Move with Intent

https://www.itshover.com/
1•typeofhuman•21m ago•0 comments

The Hidden Conversation in Breast Milk: Katie Hinde's Groundbreaking Research

https://ifeg.info/2025/12/15/the-hidden-conversation-in-breast-milk-katie-hindes-groundbreaking-r...
1•thunderbong•22m ago•0 comments

Agent Trace by Cursor: open spec for tracking AI-generated code

https://agent-trace.dev/
1•mustaphah•22m ago•0 comments

Show HN: Lumenyx – Bitcoin scarcity and full EVM, CPU mining, zero premine

https://github.com/lumenyx-chain/lumenyx
1•missed2009•23m ago•0 comments

Microsoft Is Upset (About AI Slop – and Its Hilarious)

https://www.youtube.com/watch?v=hzM-lCT1CWI
2•doener•24m ago•0 comments

Show HN: Libmagicxx – Modern C++23 wrapper for libmagic

https://github.com/oguztoraman/libmagicxx
1•oguztoraman•24m ago•0 comments

Show HN: Not_pad – a local Markdown notebook for thinking (newest ideas first)

https://github.com/SylvaMoth/not_pad
1•SylvaM•24m ago•0 comments

Changes in htmx 4.0

https://four.htmx.org/htmx-4/
1•tosh•25m ago•0 comments

Show HN: Project Xent – A native C++ UI framework in KBs

1•AzusaBCSK•27m ago•0 comments

Ask HN: OpenClaw is so January 30th. What should they rename it next?

2•tomcam•29m ago•0 comments

Show HN: Blackwell Ultra Chip Delay,MDL No 2874(JSR)

https://www.google.com/search?q=official+digital+millennium+cooyright+act&oq=official+digital+mil...
1•Lordsaltire•32m ago•0 comments

She was a broke teenager stranded in a town. Then two nuns saved the day

https://www.cnn.com/travel/nuns-greyhound-bus-breakdown-motel-great-escapes
1•Tomte•34m ago•1 comments

Gaia-X: A Federated Secure Data Infrastructure

https://gaia-x.eu/
1•tilt•35m ago•0 comments

Apple 'runs on Anthropic,' says Mark Gurman

https://9to5mac.com/2026/01/30/apple-runs-on-anthropic-says-mark-gurman/
1•aquir•36m ago•0 comments

Speed-based cognitive training reverses 10 years of brain aging

https://medium.com/@6thMind/how-speed-based-cognitive-training-reverses-10-years-of-brain-aging-2...
2•smanuel•36m ago•0 comments

Beautiful-mermaid-py Python version of beautiful-mermaid

https://github.com/Orbiter/beautiful-mermaid-py
2•orbiterlab•43m ago•0 comments

GRB 221009A

https://en.wikipedia.org/wiki/GRB_221009A
1•virgildotcodes•43m ago•0 comments

Modest Natural-Language Processing

https://github.com/spencermountain/compromise
2•amuradbegovic•46m ago•0 comments