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?

Build Windows 11 QEMU VM images deterministically with Nix

https://github.com/aleclearmind/nix-windows-in-qemu
1•aleclm•14s ago•0 comments

Apple's upcoming AI smart glasses are starting to sound more exciting

https://9to5mac.com/2026/02/21/apple-ai-smart-glasses-rumors-sounding-more-exciting/
1•gmays•30s ago•0 comments

A 62-byte FLAC file that requests 8.5GB in dr_flac, used by raylib and SDL

https://medium.com/@caplanmaor/integer-overflow-in-dr-flac-cve-2025-14369-2785de317496
2•BambaNugat•3m ago•0 comments

Chemical Weapons: A Summary Report of Characteristics and Effects

https://www.congress.gov/crs-product/R42862
2•joebig•3m ago•0 comments

Ask HN: What do I do now that software engineering is dead?

2•eerichmond33•3m ago•0 comments

Can Chain-of-Thought Reasoning Solve Any Computable Task?

https://arxiv.org/abs/2510.12066
2•ryancoleman•4m ago•1 comments

The Last Year of Terraform

https://encore.dev/blog/last-year-of-terraform
2•rzk•4m ago•0 comments

Jane Street Accused of Insider Trading That Helped Collapse Terraform

https://www.wsj.com/finance/currencies/jane-street-accused-of-insider-trading-that-helped-collaps...
2•upmind•7m ago•0 comments

People systematically overlook subtractive changes (2021)

https://www.nature.com/articles/s41586-021-03380-y
1•escapeteam•8m ago•0 comments

Tests Are the New Moat

https://saewitz.com/tests-are-the-new-moat
2•taubek•9m ago•0 comments

Show HN: I built a tool that turns Reddit conversations into video scripts

https://scriptmine.ai
1•pwnSh•10m ago•0 comments

Tell HN: Vibe Coding Taxonomy

1•andai•10m ago•0 comments

Designing APIs for AI Agents

https://www.apideck.com/blog/api-design-principles-agentic-era
1•gertjandewilde•10m ago•1 comments

Colorado Lawmakers Push for Age Verification at the Operating System Level

https://www.pcmag.com/news/colorado-lawmakers-push-for-age-verification-at-the-operating-system-l...
3•josephcsible•11m ago•2 comments

Combien de Bises ?

http://combiendebises.free.fr/index.php
1•jjgreen•11m ago•0 comments

Show HN: Rampart v0.5 – what stops your AI agent from reading your SSH keys?

https://github.com/peg/rampart
1•trevxr•12m ago•0 comments

AI podcast network publishes 11,000 episodes a day. It rips off media outlets

https://indicator.media/p/this-ai-generated-podcast-network-publishes-11-000-episodes-a-day-it-s-...
1•jaredwiener•13m ago•0 comments

My Phone Will Spam You If I Fail to Exercise by 3PM

https://taylor.town/tttl-000
1•surprisetalk•15m ago•1 comments

Show HN: Run untrusted WASM plugins with CPU/mem/network/file budgets

https://github.com/akgitrepos/wasm-plugin-sandbox
1•akgitrepos•17m ago•1 comments

Show HN: Your AI agent logged the mistake. Mine wasn't allowed to make it

https://github.com/agentbouncr/agentbouncr
1•Soenke_Cramme•18m ago•1 comments

Wisp – Full Screen Frameless Browser for iOS

https://getwisp.online/
1•janandonly•19m ago•0 comments

I got my 2nd paying customer by doing one thing: spamming about my app

https://www.founderspace.work
1•VladCovaci•19m ago•1 comments

AI bit barns grow climate emergency by turning up the gas

https://www.theregister.com/2026/02/17/ai_datacenters_driving_up_emissions/
7•PaulHoule•22m ago•0 comments

The Agent for Motion Graphics

https://www.freemotion.app/
1•jithin_g•22m ago•1 comments

One Hack Nearly Took Down the Internet (Veritasium) [video]

https://www.youtube.com/watch?v=aoag03mSuXQ
1•sbuttgereit•22m ago•0 comments

DSSP and Forth

https://wiki.xxiivv.com/docs/dssp.txt
1•tosh•23m ago•0 comments

WebSocket Mode for OpenAI Responses API

https://developers.openai.com/api/docs/guides/websocket-mode/
1•brianyu8•24m ago•0 comments

SQL vs. NoSQL: How to Answer This Interview Question in 2026

https://www.thetrueengineer.com/p/sql-vs-nosql-how-to-answer-this-interview
1•janandonly•24m ago•0 comments

Venom, run integration tests with efficiency

https://github.com/ovh/venom
1•jicea•24m ago•0 comments

Bending Emacs – Episode 12: agent-shell and Claude Skills [video]

https://www.youtube.com/watch?v=ymMlftdGx4I
2•xenodium•25m ago•0 comments