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?

A proper Docker image for WebCalendar: SQLite-backed and self-contained

https://projects.rocks/blog/webcalendar-docker.html
1•mysterhawk•1m ago•0 comments

Jiki – Learn to Code the Fun Way

https://jiki.io
1•phil-pickering•2m ago•0 comments

The Hard-Line Activists Ramping Up for the War with AI

https://www.wsj.com/tech/ai/anti-ai-activists-disappearance-sam-kirchner-6872879f
1•thm•4m ago•0 comments

The Gen X Career Meltdown (2025)

https://www.nytimes.com/interactive/2025/03/28/style/gen-x-creative-work.html
1•Michelangelo11•10m ago•0 comments

In Praise of Exhaustive Destructuring

https://antoine.vandecreme.net/blog/exhaustive-destructuring-praise/
1•avandecreme•14m ago•0 comments

AST vs. Bytecode (2023) [pdf]

https://stefan-marr.de/downloads/oopsla23-larose-et-al-ast-vs-bytecode-interpreters-in-the-age-of...
1•tosh•16m ago•0 comments

When They Steal Our Future

https://karenkelsky.substack.com/p/when-they-steal-our-future
1•Michelangelo11•17m ago•0 comments

Shark: The First Light Aircraft That Cancels Turbulence [video]

https://www.youtube.com/watch?v=wHcZf9E0esA
1•skibz•17m ago•0 comments

School Is Not Enough

https://www.palladiummag.com/2023/06/06/school-is-not-enough/
2•ronfriedhaber•18m ago•0 comments

Ghostel.el: Terminal emulator powered by libghostty

https://dakra.github.io/ghostel/
1•signa11•19m ago•0 comments

Show HN: DejaView – Terminal dashboard for all your Claude Code sessions

https://github.com/dotbrt/dejaview
1•thisbrt•20m ago•0 comments

Growing list of countries move to ban social media for children

https://www.france24.com/en/live-news/20260712-growing-list-of-countries-move-to-ban-social-media...
4•geox•21m ago•1 comments

Vyrai – a travel challenge where your age is your flight budget

https://vyrai.app/
1•Imbryk•23m ago•0 comments

Show HN: Godot running Gemma 4 inference in GDScript and Vulkan compute shaders

https://github.com/asallay/godot-llm
1•steamspaghetti•24m ago•0 comments

Show HN: Markdown Tools Online – 16 free browser-based Markdown converters

https://markdowntoolsonline.com
1•nagudharan•24m ago•0 comments

Reaction: A daemon that scans program outputs for repeated patterns, and takes a

https://framagit.org/ppom/reaction
2•fanf2•30m ago•0 comments

Puffin-Inspired Robot That Swims and Flies [video]

https://www.youtube.com/watch?v=9XJhrKpcBGI
2•skibz•38m ago•0 comments

We are now factory engineers, not product engineers

https://www.warp.dev/blog/we-are-now-factory-engineers-not-product-engineers
3•shintoist•42m ago•0 comments

Finetuning a Reasoning LLM with Supervised or Reinforcement Learning?

https://discuss.huggingface.co/t/finetuning-a-reasoning-llm-with-supervised-or-reinforcement-lear...
2•verdverm•43m ago•0 comments

Political Neutrality Benchmark of popular AI models

https://neutralityproject.org/results.html
4•ryzvonusef•51m ago•0 comments

Short Reflection on being Offline for 24 hours

https://lewiscampbell.tech/blog/260712.html
3•LAC-Tech•59m ago•0 comments

xs: Concatenative array language inspired by kdb+/q in OCaml

https://cryptm.org/xs/
3•tosh•59m ago•0 comments

Edge Password Bulk Manager

https://github.com/marinfrankovic/EdgePasswordManager
3•taubek•1h ago•0 comments

NetBSD as a Desktop: A Nostalgic '90s Experience

https://www.howtogeek.com/i-tried-netbsd-as-a-desktop-and-it-felt-like-stepping-into-the-90s-in-a...
3•birdculture•1h ago•0 comments

Teleflow: A local-first teleprompter and selfie recorder for creators

https://getteleflow.com
3•63labs•1h ago•0 comments

Show HN: LifePath – See what Einstein was doing at your exact age

https://thelifepaths.com/
2•pro_methe5•1h ago•3 comments

Forget "Fat" Models. The Future Is Narrow

https://adlrocha.substack.com/p/adlrocha-forget-fat-models-the-future
3•adlrocha•1h ago•0 comments

Show HN: InLie – See manipulation tactics in political videos, live

https://chromewebstore.google.com/detail/inlie-—-political-manipul/oajemdmhhgpifbdncldjappndcpe...
3•ivan_holovach•1h ago•0 comments

I Built a WordPress Plugin Nobody Asked For. Here's Why –. and How

https://notes.nagdy.me/2026/07/built-wordpress-plugin-nobody-asked-for-heres-why-and-how/
2•taubek•1h ago•0 comments

Stop Getting 'Good' at ChatGPT (2024)

https://hitsubscribe.com/surviving-the-great-commoditizer-stop-getting-good-at-chatgpt/
2•LAC-Tech•1h ago•0 comments