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?

Ramble Sessions with LLM's

https://twitter.com/karpathy/status/2079610838143623371
1•pretext•1m ago•0 comments

'VPNs are lawful technical tools,' says EU Court in landmark copyright ruling

https://www.techradar.com/vpn/vpn-privacy-security/vpns-are-lawful-technical-tools-says-eu-court-...
2•healsdata•3m ago•0 comments

N.J. MVC error registered 6,600 undocumented immigrants to vote

https://www.nj.com/politics/2026/07/thousands-of-undocumented-immigrants-were-registered-to-vote-...
1•speckx•9m ago•1 comments

Dementia symptoms that show up years before diagnosis

https://www.washingtonpost.com/wellness/2026/07/21/these-dementia-symptoms-can-show-up-years-befo...
1•brandonb•9m ago•0 comments

FBI Director Kash Patel Planning a Trip to Russia

https://www.reuters.com/world/us/fbi-director-kash-patel-planning-trip-russia-politico-reports-20...
6•Rooster61•9m ago•0 comments

Shardhash Protocol: Sharden Issuer

https://github.com/babakkarimib/shardhash
1•babakkarimib•10m ago•0 comments

OpenAI Shares Some Alignment Problems

https://thezvi.substack.com/p/openai-shares-some-alignment-problems
2•7777777phil•10m ago•0 comments

Jobflo is getting more useful

https://apps.apple.com/us/app/jobflo-private-job-tracker/id6759933192
1•jsrothwell•10m ago•0 comments

Pete Hegseth's Reckless Message to Helicopter Pilots

https://www.theatlantic.com/international/2026/07/hegseth-reckless-military-helicopter/688008/
4•Jtsummers•11m ago•0 comments

Why AI Needs a "Genie Coefficient"

https://spectrum.ieee.org/ai-agent-benchmark
1•mikelgan•11m ago•1 comments

SWARÓG: a highly powerful agent for network monitoring and content generation

https://medium.com/@a.galecki/swar%C3%B3g-highly-powerful-agent-for-network-monitoring-and-conten...
1•NodesHub•12m ago•1 comments

Fei-Fei Li says robotics simulation startup SceniX joins World Labs

https://runtimewire.com/article/fei-fei-li-scenix-joins-world-labs
1•ryanmerket•13m ago•0 comments

Show HN: Ounce, Stop measuring wealth in inflating fiat. Measure it in gold

https://useounce.com/
1•halfradaition•13m ago•0 comments

Show HN: Observability for Coding Agents and LLM Applications

https://telemetry.dev/
2•ephraimduncan•14m ago•0 comments

Impossible Colors

https://en.wikipedia.org/wiki/Impossible_color
1•akramachamarei•15m ago•1 comments

Ask HN: My Microsoft for Startups subscription is expiring

1•alexander2002•16m ago•0 comments

Substack adds an AI detector to help spot blogs written by no one

https://www.theverge.com/ai-artificial-intelligence/968855/substack-pangram-ai-detecting-tool
1•droidjj•16m ago•0 comments

Gritt: AI to Build Infrastructure with Robotics

https://www.gritt.ai/
1•wslh•16m ago•0 comments

Show HN: Collecte MTL – niche web app to know Montreal waste collection schedule

https://collectemtl.ca/
2•scastiel•17m ago•0 comments

Bruno Blocker – I made an free and lightweight focus app

https://www.brunoblocker.com/
2•aksel_salmi•18m ago•2 comments

France first European country to ban social media access for under-15s

https://www.theguardian.com/world/2026/jul/21/france-ban-social-media-access-under-15s
4•Erikun•18m ago•0 comments

Show HN: Posecode, a text language and renderer for human movement

https://www.posecode.org/play
5•brnbrn•18m ago•0 comments

Jimothy the raccoon has a rare spinal condition. Here's what that means

https://www.popsci.com/science/whats-jimothy-raccoon-condition/
2•speckx•19m ago•0 comments

Wordle

https://en.wikipedia.org/wiki/Wordle
3•chistev•20m ago•0 comments

Three-Body Scattering for Generative Modeling

https://arxiv.org/abs/2607.18198
2•E-Reverance•20m ago•0 comments

Judge approves $1.5B Anthropic settlement, reduces class counsel fees to 6.8% [pdf]

https://storage.courtlistener.com/recap/gov.uscourts.cand.434709/gov.uscourts.cand.434709.680.0_4...
5•ilamont•22m ago•0 comments

New HollowGraph malware uses Microsoft Graph for stealthy C2 comms

https://www.bleepingcomputer.com/news/security/new-hollowgraph-malware-uses-microsoft-graph-for-s...
5•devonnull•22m ago•0 comments

ACP v2 is available in Draft

https://agentclientprotocol.com/announcements/acp-v2-draft
2•artooro•25m ago•0 comments

June 23, 2026: The Night France Saved the British Grid

https://dispatches.kilowatts.io/p/a-midsummer-nights-near-miss
5•bookofjoe•25m ago•0 comments

Synthetic Consumer Panels Without Microdata via IPF

https://papers.ssrn.com/sol3/papers.cfm?abstract_id=7122180
1•7777777phil•26m ago•0 comments