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?

What to Expect when Using 5G DECT NR+ [pdf]

https://hal.science/hal-05287148v1
1•teleforce•1m ago•0 comments

Show HN: AIWriteBook – AI tool to write, design, and publish full-length books

https://aiwritebook.com
1•marakaci•4m ago•0 comments

No-doomscroll: Ad-block filter lists to hide social media feeds

https://github.com/ZenPrivacy/filter-lists/blob/master/no-doomscroll/readme.md
1•anfragment•6m ago•0 comments

I Fixed Windows Native Development

https://marler8997.github.io/blog/fixed-windows/
1•deevus•6m ago•0 comments

A Forth vocabulary for iteration (2023)

https://blog.information-superhighway.net/a-forth-vocabulary-for-iteration
1•tosh•7m ago•0 comments

AgentProbe – adversarial security testing for AI agents (134 attack patterns)

https://github.com/alexmelges/agentprobe
1•alexmelges•8m ago•0 comments

Sortie En Mer

https://drowningsimulator.wtf/
1•carlos-menezes•10m ago•0 comments

Show HN: Free mission statement generator – paste URL, get draft in 5s

https://champsignal.com/tools/mission-statement-generator
1•maximedupre•15m ago•0 comments

Rune – Open spec pattern for consistent AI code generation

https://github.com/vict00r99/Rune-stone
2•vict00r99•17m ago•1 comments

UltrafastSecp256k1 Zero-dep C++20 secp256k1 with ASM,CUDA, 27 coins,MuSig2,FROST

https://github.com/shrec/UltrafastSecp256k1
2•shrecshrec•17m ago•1 comments

Epstein LLM

https://github.com/lachameleon/epstein-llm
2•handfuloflight•18m ago•0 comments

A WebAssembly Core for Uxn (2023)

https://mko.re/blog/uxn-wasm/
1•tosh•22m ago•0 comments

Why Are Geniuses Destroying Jobs in Uganda? (2017)

https://www.cgdev.org/blog/why-are-geniuses-destroying-jobs-uganda
2•alabhyajindal•24m ago•0 comments

When Germany Seized the Future: Lessons from CAD for the AI Era

https://andrulis.de
2•davedx•26m ago•0 comments

An AI agent harassed a Matplotlib maintainer. We're asking the wrong question

https://chaosguru.substack.com/p/who-opened-the-door
2•allixsenos•31m ago•0 comments

Show HN: Pangolin: Open-source identity-based VPN (Twingate/Zscaler alternative)

https://github.com/fosrl/pangolin
2•miloschwartz•42m ago•0 comments

Show HN: I built a map where anyone can rename anything

https://rename.world/
5•kafked•44m ago•0 comments

What Happens After the Hero? The Section That Decides If Users Stay

https://www.indiehackers.com/post/what-happens-after-the-hero-the-section-that-decides-if-users-s...
1•allinonetools_•45m ago•0 comments

A Pokémon of a Different Color

https://matthew.verive.me/blog/color/
1•Risse•51m ago•0 comments

France assembles magistrate team to examine 'Epstein files'

https://www.dw.com/en/epstein-files-france-investigation-magistrates/a-75975774
2•pera•51m ago•0 comments

Show HN: Manga Viewer – Zero-dep manga/comic reader in vanilla JavaScript

https://github.com/tokagemushi999/manga-viewer
2•tokagemushi•54m ago•0 comments

AI to stay in Flow – a personal decision on how I chose to (not) use AI

https://www.dev-log.me/ai_to_stay_in_flow/
1•wazHFsRy•58m ago•0 comments

AI Agent Lands PRs in Major OSS Projects, Targets Maintainers via Cold Outreach

https://socket.dev/blog/ai-agent-lands-prs-in-major-oss-projects-targets-maintainers-via-cold-out...
1•choult•58m ago•0 comments

Starflight

https://en.wikipedia.org/wiki/Starflight
1•tosh•59m ago•0 comments

Storepage – I'm a tool builder making app launch pages less painful

https://storepage.app
1•scaleinitiative•1h ago•1 comments

Show HN: Visual state tracking for AI agents in tmux

https://github.com/accessd/tmux-agent-indicator
1•accessd•1h ago•0 comments

Former teen superstar James Van Der Beek needed help to pay his medical bills

https://www.bbc.com/news/articles/cx2dw01p7k8o
2•breve•1h ago•0 comments

The great computer science exodus (and where students are going instead)

https://techcrunch.com/2026/02/15/the-great-computer-science-exodus-and-where-students-are-going-...
1•e2e4•1h ago•0 comments

Show HN: Addictive little browser game involving gravity

https://retroburn.space/
1•amiralul•1h ago•0 comments

Paper Plotter

https://felixboiii.github.io/paper-plotter/#create-function
3•Tomte•1h ago•0 comments