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?

Formally Verifying AI-Generated GPU Kernels

https://gimletlabs.ai/blog/formally-verifying-ai-generated-kernels
1•matt_d•32s ago•0 comments

Why is music so much easier for AI than code?

1•htlemur_bobby•1m ago•0 comments

Florida's OpenAI lawsuit moves to federal court, gets assigned to Aileen Cannon

https://www.politico.com/news/2026/07/08/floridas-openai-lawsuit-federal-court-aileen-cannon-0099...
1•1vuio0pswjnm7•10m ago•0 comments

Controlling the Human Body via EMS

https://github.com/danielkaijzer/Human-Operator
1•kaonwarb•11m ago•0 comments

Ask HN: Multiple MCP Native Tools?

1•edifil•11m ago•0 comments

NEO's Hands – An API to the Physical World

https://www.1x.tech/discover/neos-hands
1•dsr12•13m ago•0 comments

Sheaf theory: from deep geometry to deep learning (2025)

https://arxiv.org/abs/2502.15476
1•measurablefunc•15m ago•0 comments

Clamshell style cyberdeck built around the Raspberry Pi Compute Module 5

https://github.com/sb-ocr/cmdeck
1•tortilla•17m ago•0 comments

OpenAI unveils long-awaited "super app" as rivalry with Anthropic intensifies

https://www.reuters.com/business/openai-launches-chatgpt-work-2026-07-09/
1•adithyaharish•21m ago•0 comments

Migrating Code by Proof: From F# to Python

https://www.logosresearch.ai/news/migrating-code-by-proof/
1•peterkelly•22m ago•0 comments

Paranoid LLMs

https://whyjay.vercel.app/thoughts/paranoid-llms/
1•juggy69•22m ago•0 comments

Show HN: R3 – A Local Code Review Tool for You and Your AI Agent

https://github.com/hyperlogue/r3
1•rickye26•25m ago•0 comments

What Happened to Commodore? Why the Amiga Disappeared

https://www.youtube.com/watch?v=IXitMm7aeV8
2•cable2600•26m ago•0 comments

Earliest example of right-handedness found in Australian fossils

https://www.cnn.com/2026/07/09/science/earliest-animal-right-handedness-spriggina-floundersi
1•Tomte•27m ago•0 comments

Data Science Weekly – Issue 659

https://datascienceweekly.substack.com/p/data-science-weekly-issue-659
1•sebg•32m ago•0 comments

Brave Bat Roadmap 4.0

https://brave.com/blog/bat-roadmap-4-0/
1•twapi•37m ago•0 comments

The most, and least, liveable cities in 2026

https://www.economist.com/graphic-detail/2026/07/06/the-worlds-most-and-least-liveable-cities-in-...
2•andsoitis•39m ago•1 comments

Can you run every line of code in Super Mario Bros.?

https://www.youtube.com/watch?v=o0gOALTvkcc
1•badc0ffee•40m ago•0 comments

Show HN: AppleWalls – free 4K wallpapers for Apple devices

https://www.applewalls.com/en
1•fenggit•43m ago•0 comments

InternNav – Navigation Toolbox

https://github.com/InternRobotics/InternNav
1•rickcarlino•45m ago•0 comments

Audar-ASR-V1:Arabic-first speech recognition foundation models with open weights

1•AudarAI•48m ago•1 comments

LKML-reader: a Rust-based interactive reader for Linux Kernel Mailing Lists

https://github.com/RinHizakura/lkml-reader
1•RinHizakura•49m ago•0 comments

Class action suit over deepfake child sexual abuse material expands

https://text.npr.org/nx-s1-5885052
2•1659447091•51m ago•0 comments

Show HN: I made the Chrome Dino Game editable by your AI prompts

https://vibedino.com
1•johnnyapple•53m ago•0 comments

The Oral History of the Dinosaur Input Device (DID)

https://vfxblog.com/dinosaurinputdevice/
1•fabiensanglard•1h ago•0 comments

Graphic Data Processing – 1965 IBM System/360 Computer Lecture and Demonstration [video]

https://www.youtube.com/watch?v=Y0FY3CDCw1o
1•besserwisser•1h ago•0 comments

Pressurizing a Chicken Coop to Clean it [video]

https://www.youtube.com/watch?v=jYspl74j5eM
1•oftenwrong•1h ago•0 comments

Verla: Free AI Humanizer&assignment helper

https://verla.io
1•kaitsai•1h ago•0 comments

How a Transformer Plays Tic-Tac-Toe

https://sbondaryev.dev/articles/transformer
1•thunderbong•1h ago•0 comments

Netflix Is Exploring Live TV and Bundles as It Struggles to Keep Viewers Hooked

https://www.wsj.com/business/media/netflix-is-exploring-live-tv-and-bundles-as-it-struggles-to-ke...
2•mikhael•1h ago•0 comments