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?

When you can't escape an interface, it institutionalises you

https://timmb.com/when-you-cant-escape-an-interface/
1•timmb•11m ago•0 comments

Show HN: AI Agent Team Framework

https://github.com/danilocaffaro/ai-agent-team-guide
1•caffaroai•11m ago•0 comments

Periodic Table

https://www.periodicspiral.com
1•downboots•11m ago•0 comments

Show HN: We analyzed 312 landing pages – most navigation flows are broken

1•epic_ai•12m ago•1 comments

There Are No Psychopaths

https://aeon.co/essays/psychopathy-is-a-zombie-idea-why-does-it-cling-on
1•limbicsystem•14m ago•0 comments

First known satellite image of Ayatollah Ali Khamenei's compound in Tehran

https://twitter.com/trbrtc/status/2027703248887427576
1•us321•18m ago•0 comments

Show HN: Prompt-run – run .prompt files against any LLM from the terminal

https://github.com/Maneesh-Relanto/Prompt-Run
1•maneeshthakur•19m ago•0 comments

Show HN: Windows Taskbar Monitor for Claude Code Usage (Rust, Open Source)

https://github.com/CodeZeno/Claude-Code-Usage-Monitor
1•codezeno•19m ago•1 comments

Who Is the Kimwolf Botmaster "Dort"?

https://krebsonsecurity.com/2026/02/who-is-the-kimwolf-botmaster-dort/
1•todsacerdoti•20m ago•0 comments

Show HN: hosted or self-hosted open-source Intercom alternative, Convex Backend

https://github.com/opencom-org/opencom
1•jackjayd•20m ago•0 comments

Lenna attended the 50th Anniversary IS&T conference

https://www.lenna.org/lenna_visit.html
1•Kiboneu•22m ago•1 comments

Cloudflare: Asynchronous Stale-While-Revalidate

https://developers.cloudflare.com/changelog/post/2026-02-26-async-stale-while-revalidate/
2•tosh•23m ago•0 comments

Trump announces 'major combat operation' in Iran

https://apnews.com/live/live-updates-israel-iran-february-28-2026
1•josephwegner•24m ago•0 comments

NASA announces Artemis III mission no longer aims to send humans to moon

https://www.theguardian.com/science/2026/feb/27/nasa-changes-delays-moon-missions
1•edward•24m ago•0 comments

What to Know About the U.S. Attacks on Iran

https://www.nytimes.com/2026/02/28/world/middleeast/iran-attacks-what-to-know.html
1•JumpCrisscross•25m ago•1 comments

Move over, Apple: Meet alternative app stores available in the EU and elsewhere

https://techcrunch.com/2026/02/22/move-over-apple-meet-the-alternative-app-stores-available-in-th...
1•taubek•26m ago•0 comments

How to Remove ChatGPT from Apple Intelligence

https://www.trustedreviews.com/how-to/remove-chatgpt-apple-intelligence-4580438
2•drcongo•30m ago•0 comments

Sync your coding agent activity across sessions and users

https://github.com/mubit-ai/codaph
1•aperi•32m ago•0 comments

How I Met My Wife (1994)

https://www.newyorker.com/magazine/1994/07/25/how-i-met-my-wife
1•Wowfunhappy•35m ago•0 comments

Ask HN: Why spec-driven development when code IS spec?

1•kikkupico•36m ago•5 comments

Show HN: H-CLI – Manage network infrastructure with natural language

https://github.com/h-network/h-cli
1•h-network•39m ago•0 comments

The week when AI changed everything

https://www.cnn.com/2026/02/28/business/ai-week-anthropic-nvidia-block
1•edward•41m ago•0 comments

Show HN: EEGFrontier – A compact open-source EEG board using ADS1299

https://github.com/TheusHen/EEGFrontier
1•TheusHen•41m ago•0 comments

How to downgrade from macOS 26 Tahoe on a new Mac

https://arstechnica.com/gadgets/2026/02/how-to-downgrade-from-macos-26-tahoe-on-a-new-mac/
2•signa11•46m ago•1 comments

Show HN: Core – Constitutional governance runtime for AI coding agents

https://github.com/DariuszNewecki/CORE
1•DNewecki•47m ago•0 comments

Addressing AI-slop in security reports

https://github.com/apache/logging-log4j2/discussions/4052
2•birdculture•47m ago•0 comments

Hypothetical nuclear attack that escalated Pentagon's showdown with Anthropic

https://www.washingtonpost.com/technology/2026/02/27/anthropic-pentagon-lethal-military-ai/
1•pseudolus•48m ago•1 comments

The Great Stink

https://en.wikipedia.org/wiki/Great_Stink
1•thinkingemote•49m ago•0 comments

We Chose SQLite

https://curling.io/blog/why-we-chose-sqlite
1•enz•52m ago•0 comments

We the Bacteria. Notes Toward Biotic Architecture

https://we-make-money-not-art.com/we-the-bacteria-notes-toward-biotic-architecture/
2•thinkingemote•52m ago•0 comments