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?

Update for October 30th, 2026 Data Security Incident

https://workos.com/security/bulletins/update-for-october-30th-2026-data-security-incident
2•meetpateltech•2m ago•0 comments

Lessons from Building Copilot Cowork

https://commandline.microsoft.com/how-we-built-copilot-cowork-python-to-rust-migration/
1•gmays•3m ago•0 comments

Few Repercussions for Continued Gas Leaks After Couple's Death

https://insideclimatenews.org/news/03112026/few-repercussions-for-oil-firms-continued-leaks-after...
2•paimapi•3m ago•0 comments

GrapheneOS accuses YC of funding surveillance and enabling HN harassment

https://twitter.com/GrapheneOS/status/2118490356958597210
4•user_7832•7m ago•3 comments

Andrew Weldon post mortem on his Quake 4 levels

https://andrew-weldon.design/quake4.htm
1•klaussilveira•7m ago•0 comments

If your code chatbot was genuinely honest

1•chrisjj•7m ago•0 comments

GEO600 – A Vacuum Leak in the North Arm (2017)

https://www.geo600.org/77883/august-2017
1•_Microft•8m ago•0 comments

OneUptime 14.0: open-source observability platform adds data observability

https://github.com/OneUptime/oneuptime
2•bigoupea•8m ago•0 comments

show HN: Computer-Generated Asset Pipelines: Shading Language in Toy Story (1995)

https://codeaihq.com/computer-generated-asset-pipelines-shading-language-in-toy-story-1995/
2•CodeAIHQ•10m ago•0 comments

AI Product Team – 64 specialized AI agent roles with executable CLI workflows

https://github.com/3orionkings/ai-product-team
2•3orionkings•12m ago•0 comments

METR: Independent Assessment of AI R&D Acceleration at Anthropic in October 2026

https://www.lesswrong.com/posts/N5AmYkRks5CqAxvBg/metr-independent-assessment-of-ai-r-and-d-accel...
2•alach11•12m ago•0 comments

Humans slowly change, and that is our chance

https://evergreendesign.io/essays/humans-slowly-change-and-that-is-our-chance/
2•violinar•12m ago•0 comments

Piuma: New open source status bar for Hyprland

https://github.com/logicheneurali/piuma
2•logineur•13m ago•1 comments

Stay ahead in AI race; Build on next AI Idea

https://github.com/mukeshatnyc/dAIly
2•mukeshsinghnyc•14m ago•0 comments

VCF West Presentation: Is That Unix? – Sean Haas [video]

https://www.youtube.com/watch?v=RjtxpvXT5cA
2•oldnetguy•17m ago•0 comments

Harness 2: executing agent code as it streams

https://www.framer.com/blog/harness-2/
2•gmays•19m ago•0 comments

Devvm.dev: One VM for every project

https://devvm.dev/
2•luispa•19m ago•0 comments

Bye Deno, Hello Cloudflare

https://nerdy.dev/bye-deno-hello-cloudflare
3•speckx•19m ago•0 comments

Apple's grey list: iPhone won't autocorrect 'male chauvinist pig'

https://www.theguardian.com/technology/2026/nov/06/struggling-to-spell-male-chauvinist-pig-apple-...
2•uxhacker•19m ago•1 comments

When dreams feel real: the MÖBIUS model

https://www.nature.com/articles/s42003-026-09781-x
2•bryanrasmussen•20m ago•0 comments

Figma for hardware: AI can generate CAD, but what should we build?

https://opuslabs.substack.com/p/building-the-judgment-layer-for-hardware
1•opuslabs•21m ago•0 comments

The agentic web is here

https://www.technologyreview.com/2026/11/02/1147846/the-agentic-web-is-here/
1•bookofjoe•21m ago•0 comments

Show HN: Thesis, checks every SEC filing against why you own a stock

https://www.mythesis.ai
1•juansrome•22m ago•0 comments

Counting words-hacking human-cheat code

1•thaumaturgicon-•22m ago•1 comments

Ask HN: What have the past 12 months taught you?

2•chistev•23m ago•0 comments

Just how far can the FOR UPDATE SKIP LOCKED Postgres queue go?

https://garbagecollected.io/posts/postgres-task-queue-where-it-breaks/
1•gh5689•23m ago•0 comments

Anthropic IPO valuation talks drop to $1.3T

https://epyhia.com/anthropic-ipo-valuation-talks-drop-to-1-3-trillion-as-major-investors
18•arbuge•28m ago•4 comments

OpenAI will keep investing in AI data centers despite election results

https://www.cnbc.com/2026/11/06/open-ai-data-centers-election.html
3•pretext•31m ago•1 comments

Doom 3 BFG source code review

https://fabiensanglard.net/doom3_bfg/index.php
1•klaussilveira•32m ago•0 comments

Show HN: Wrapped – Your neighborhood's 311 story

https://311wrapped.com/
1•eltokh7•33m ago•0 comments