frontpage.
newsnewestaskshowjobs

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?

The Golden Rule for Becoming a Better Writer

https://nappertime.com/the-golden-rule-of-becoming-a-better-writer/
1•andsoitis•10m ago•0 comments

Small Models Can Introspect, Too (2025)

https://vgel.me/posts/qwen-introspection/
1•vismit2000•10m ago•0 comments

Reading List Hotkey: Save Web Pages to Apple Reminders Using Shortcuts App

https://rdamodar.com.np/thought/2026/08/2026-08-22-reading-list-hotkey/
1•fhcxvbdb•10m ago•0 comments

The dark underbelly of "Paw Patrol"

https://www.economist.com/culture/2026/08/07/the-dark-underbelly-of-paw-patrol
1•andsoitis•12m ago•0 comments

AI Power Scaling Cuts Both Ways

https://nervecenter.github.io/ai_power_scaling_cuts_both_ways.html
1•netbioserror•18m ago•0 comments

Thalamocortical Circuit Motifs: A General Framework (2019)

https://www.sciencedirect.com/science/article/pii/S0896627319305550
1•andsoitis•18m ago•0 comments

Russian Hackers on Top

https://www.pravda.com.ua/eng/news/2026/08/14/8048610/
1•Preston67•26m ago•1 comments

MartyPC is a cross-platform emulator of early PCs written in Rust

https://martypc.net/
1•boilerupnc•29m ago•0 comments

(Looking 4 Co-Founder) Hyper Terawatt:Piston-Less V8 Engine Architecture

https://drive.google.com/file/d/18pYk3csOIm82M957FKuYJeTAZ6LCFh8-/view?usp=sharing
1•117l11•48m ago•0 comments

Phase.rs – a full featured MTG SIM in Rust

https://github.com/phase-rs/phase
1•dirteater_•57m ago•0 comments

Even More Formal Verification for BPF

https://lwn.net/Articles/1087069/
1•pykello•58m ago•0 comments

Grep: Structural Code Search

https://grep.codemod.com/
1•handfuloflight•1h ago•0 comments

How to archive Everything and share It

https://aramzs.github.io/steal-the-internet/
1•toomuchtodo•1h ago•1 comments

Passive 3D Thermal "Cloak" Hides Objects from Heat, from Any Direction

https://www.electronicdesign.com/technologies/power/article/55399858/electronic-design-passive-3d...
1•WaitWaitWha•1h ago•0 comments

Ask HN: Anyone set up ways to easily obtain and read transcripts from Ted, YT?

1•MollyRealized•1h ago•1 comments

Show HN: LayoutLens: AI-Powered Visual UI Testing

https://github.com/gojiplus/layoutlens
1•neehao•1h ago•0 comments

I Dream of Quieter Computing

https://henry.codes/writing/i-dream-of-quieter-computing/
2•Sir_Twist•1h ago•0 comments

Edify – Windows NLE: OpenFX, proxy editing, AI subs, vtuber tools ($29.99 once)

https://apps.microsoft.com/detail/9nkkk5k5s4ct?hl=en-US&gl=US
1•edify_nle•1h ago•0 comments

AI Chip Architectures

https://www.jepeake.com/ai-chip-architectures
1•Finbarr•1h ago•0 comments

Compactor: A user interface for Windows 10 filesystem compression

https://github.com/Freaky/Compactor
1•thunderbong•1h ago•0 comments

Neutron stars: smoother than billiard balls – unfortunately

https://ligo.org/science-summaries/o4aallskyisolatedcw/
2•raattgift•1h ago•0 comments

Heeramandi: The Diamond Bazaar (Lahore, Pakistan) [video]

https://www.youtube.com/watch?v=Sz064J6qRdQ
1•tkgally•1h ago•1 comments

Psychological Coupling

https://osf.io/preprints/psyarxiv/695gp_v1
1•silverpiranha•1h ago•0 comments

Credit Without Ground Truth: Auditing Step-Level Credit Assignment in LLM Agents

https://arxiv.org/abs/2608.19760
1•sbulaev•1h ago•0 comments

The incoming Developer Experience revolution

https://kwojcicki.github.io/blog/NEW-AGE-OF-DEV-EX
1•kwojcicki•1h ago•0 comments

Why can AI generate Super Mario but not a wedge ramp for my robot vacuum?

2•zhuchaokn•1h ago•0 comments

Show HN: CtrlTool – 132 free online tools for developers and everyday tasks

https://ctrltool.wtf
1•jetroni•1h ago•0 comments

Apple degrades privacy and encryption of iMessage with AI integrations

https://twitter.com/stevemoraco/status/2091194172917338520
4•daniel_iversen•2h ago•1 comments

Treat AI Like an Intern, Not Software: A Stanford Professor's Guide

https://pixelum.substack.com/p/treat-ai-like-an-intern-not-software
1•mooreds•2h ago•2 comments

Microsoft Entra ID Remote Code Execution Vulnerability

https://msrc.microsoft.com/update-guide/vulnerability/CVE-2026-69836
3•mooreds•2h ago•1 comments