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?

Judge blocks first state law that would have banned prediction markets

https://arstechnica.com/tech-policy/2026/07/judge-blocks-first-state-law-that-would-have-banned-p...
1•pseudolus•2m ago•0 comments

Show HN: My Next.js .next folders hit 34 GB, so I built next-nuke to clean them

https://github.com/RoyBkker/next-nuke
1•bakkerinho•3m ago•0 comments

Ask HN: Does Brook's Law continue to hold in the age of AI?

1•erikig•4m ago•0 comments

Say hi to new Ojai in-car experience

https://waymo.com/blog/2026/07/gemini-in-waymo/
1•sdhillon•5m ago•0 comments

Fnox: Manage secrets with encryption or cloud providers – or both

https://fnox.jdx.dev/
2•thunderbong•6m ago•0 comments

New documentary recounts 'attitude of cruelty' toward axed federal employees

https://www.govexec.com/workforce/2026/07/documentary-recounts-cruelty-axed-federal-employees/415...
1•petethomas•6m ago•0 comments

Data centers are slowing America's shift away from coal

https://grist.org/energy/data-centers-electricity-power-coal-emissions-climate-report/
1•speckx•6m ago•0 comments

Spiderman to the Rescue

https://apnews.com/article/spiderman-good-samaritan-arkansas-traffic-42e01f656e66ab26df4ea0e2ef59...
2•ninju•8m ago•0 comments

The Silicon Valley Health Trend Making Doctors Nervous

https://www.nytimes.com/2026/07/29/opinion/health-data-trend-body.html
2•bonsai_spool•8m ago•1 comments

Give every AI project its own computer

https://github.com/futrx-com/remote.futrx
3•futrx•11m ago•0 comments

Walmart Leapfrogs EV Charging Competitors with Rapid Buildout

https://www.bloomberg.com/news/articles/2026-07-29/why-walmart-is-quickly-adding-charging-station...
2•toomuchtodo•12m ago•1 comments

eBay's cyberstalking saga ends with a $56M settlement

https://www.theverge.com/tech/972209/ebay-cyberstalking-harassment-settlement
2•haunter•12m ago•1 comments

His restaurant put edible ants on the menu. He could face one year in prison

https://www.cnn.com/2026/07/23/travel/south-korea-restaurant-ant-dessert-jail-intl-hnk
2•raybb•13m ago•0 comments

Content Creator

https://www.elenaverna.com/p/so-you-want-to-be-a-content-creator
2•AnhTho_FR•13m ago•0 comments

Existential Types on a Leash in Haskell

https://cdfa.github.io/existentials-on-a-leash/
2•fanf2•15m ago•0 comments

In China, people are renting out their faces to AI

https://restofworld.org/2026/china-ai-microdramas-face-licensing/
2•antondd•16m ago•0 comments

What happens when you put AI to work deciphering lost languages?

https://theconversation.com/cracking-the-code-can-ai-help-us-decipher-ancient-languages-288238
1•staplung•17m ago•0 comments

Default model enablement for Copilot Business and Enterprise

https://github.blog/changelog/2026-07-29-default-model-enablement-for-copilot-business-and-enterp...
1•smokeeaasd•17m ago•0 comments

Blocking AI Crawlers on Your Mastodon Server, Nginx Edition

https://justinribeiro.com/chronicle/2026/07/28/blocking-ai-crawlers-on-your-mastodon-server-nginx...
1•speckx•18m ago•0 comments

Reverse Engineering Google's Proprietary Hypervisor

https://alexhulbert.com/posts/reverse-engineering-googles-proprietary-hypervisor/
1•dongcarl•18m ago•0 comments

Big Companies Are Starting to Hire Again, Defying Predictions of AI Wipeout

https://www.wsj.com/business/big-companies-are-starting-to-hire-again-defying-predictions-of-ai-w...
6•theanonymousone•21m ago•2 comments

Apple won't turn on any 'restricted mode' for missed lease payments

https://www.theverge.com/tech/972063/apple-upgrade-program-no-restricted-mode
2•apparent•22m ago•1 comments

Link rescue mission for NASA Swift Telescope suffers critical malfunction

https://www.scientificamerican.com/article/rescue-mission-to-save-nasas-swift-space-telescope-is-...
2•ck2•22m ago•1 comments

OpenAI's rogue agent compromised a customer at a second tech firm

https://www.reuters.com/business/openais-rogue-agent-compromised-an-account-second-tech-firm-sour...
2•JumpCrisscross•22m ago•0 comments

Funny: Someone thinks Linux source Code was "leaked"

https://twitter.com/forloopcodes/status/2081089016250949651
1•philit•23m ago•0 comments

Show HN: UnUI – Help coding agents make better design decisions

https://unui.cc/
3•heywitt•26m ago•0 comments

Open sourced index of 3000 APIs

https://github.com/mindcloud-inc/universal-api-reference
3•frabjoused•26m ago•0 comments

Show HN: Sealed crypto forecast dataset – my 50% intervals covered 84%

https://huggingface.co/datasets/neuportal/neuportal-sealed-crypto-forecasts
2•neuportal•26m ago•0 comments

Tiyov, real-time speech translation in your own voice

https://github.com/kirandas-reload/tiyov
1•kd_reload•27m ago•0 comments

AI 'Raygun' can shrink and supersize proteins – enabling easy editing

https://www.nature.com/articles/d41586-026-02335-5
1•geneticdrifts•31m ago•0 comments