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?

The Legal Agent Stack

https://lexifina.com/blog/the-legal-agent-stack
1•alansaber•52s ago•0 comments

Ask HN: What have you used natural language identification tools for?

1•nitotm•3m ago•0 comments

Maersk Middle East Operational Update 35

https://www.maersk.com/news/articles/2026/06/10/middle-east-operational-update-35
1•mooreds•5m ago•0 comments

EU AI: the fables we told ourselves

https://pleias.ai/blog/fable-eu
2•barrenko•6m ago•0 comments

Secondary Stops in Cities on Intercity Rail

https://pedestrianobservations.com/2026/06/03/secondary-stops-in-cities-on-intercity-rail/
1•mooreds•6m ago•0 comments

The 2-Year Apartment Rule

https://tadaima.bearblog.dev/the-2-year-apartment-rule/
1•surprisetalk•6m ago•0 comments

I was obsessed with money then I found philosophy

https://dariusforoux.com/i-was-obsessed-with-money-then-i-found-philosophy/
1•RickJWagner•6m ago•0 comments

Solving the hallucination problem in agents – with loops and math

https://kasparvongruenberg.substack.com/p/solving-the-hallucination-problem
1•mooreds•6m ago•0 comments

India's solution to entrance exam fraud: A temporary ban on Telegram

https://www.cnbc.com/2026/06/16/indias-solution-to-entrance-exam-fraud-a-temporary-ban-on-telegra...
2•LordAtlas•7m ago•0 comments

dj_queue: DB-backed queue backend for django.tasks

https://github.com/coriocactus/dj_queue
1•coriocactus•7m ago•0 comments

How much an Uber driver makes in Boston

https://www.boston.com/community/readers-say/2026/06/15/heres-how-much-an-uber-driver-makes-in-bo...
1•ripe•11m ago•1 comments

Show HN: Query the Murder – Learn SQL by Solving Agatha Christie Mysteries

https://querythemurder.com/
1•jenikashah07•11m ago•0 comments

Don't run SQL migrations in tests: How I sped up the test suite by 2x

https://gaultier.github.io/blog/I_sped_up_the_test_suite_by_x2.html
1•birdculture•15m ago•0 comments

NEET: India temporarily bans Telegram to tackle fraud in key medical exam

https://www.bbc.com/news/articles/cn074j04l3eo
2•colinprince•15m ago•0 comments

What's your Opinion onm he recent updates on Fable 5?

1•shymasen•16m ago•1 comments

Oracle Cerner: Potential Acquirers of Oracle Health

https://www.healthcare.digital/single-post/oracle-cerner-potential-acquirers-of-oracle-health
2•akyuu•16m ago•0 comments

Show HN: Codify – Terraform for Dev Environments

https://codifycli.com/
1•kevinwang5658•17m ago•0 comments

FootyChat – Live fan chat and scores for World Cup 2026

https://footychat.app/
1•olympikesoft•18m ago•0 comments

GoLongRL: Capability-Oriented Long Context RL with Multitask Alignment

https://github.com/xiaoxuanNLP/GoLongRL
1•pbd•20m ago•0 comments

Awesome Bash: A curated list of delightful Bash scripts and resources

https://github.com/awesome-lists/awesome-bash
1•martinlaz•20m ago•0 comments

Survey: Pro-Democratic Social Views Vary by Social Media Platform

https://news.gallup.com/poll/710702/pro-democratic-social-views-vary-social-media-platform.aspx
1•giuliomagnifico•22m ago•0 comments

Codex Is Down

https://status.openai.com/incidents/01KV7ZT644J4V94GSXMFPY2ANR
4•jampekka•24m ago•0 comments

Native Bitcoin Token Protocol

https://boltassociation.com/
2•honohanf•25m ago•1 comments

Welcome to the Agentic Era. Ready or Not

https://www.mikehyland.com/blog/welcome-agentic-era
1•mjhyl•25m ago•0 comments

MiniForge – describe a game, get IAP, GPU compute, and leaderboards free

https://miniforge.buzzchat.site
1•abilafredkb•26m ago•0 comments

SpaceX to buy Cursor for $60B (WSJ)

https://www.wsj.com/business/spacex-agrees-to-buy-ai-coding-agent-cursor-for-60-billion-7a473340
7•Retz4o4•28m ago•0 comments

Savearoundtrip: Publish an HTTPS DNS record, skip a round trip

https://savearoundtrip.com/
1•cimnine•29m ago•0 comments

Commodore's new flip phone blocks social media and browsers

https://arstechnica.com/gadgets/2026/06/commodores-newest-gadget-is-a-flip-phone-that-blocks-soci...
2•bookofjoe•32m ago•0 comments

How Intelligent Automation Works

https://geekyants.com/blog/how-intelligent-automation-is-cutting-healthcares-600-billion-administ...
2•shymasen•33m ago•0 comments

Generative Models (2016)

https://openai.com/index/generative-models/
1•capitalatrisk•33m ago•0 comments