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?

Ask HN: How do non-resident founders meet others in SF?

1•aperi•42s ago•0 comments

China Stockpiled Oil, and Now It Could Dominate the Energy Landscape

https://www.nytimes.com/2026/09/17/business/energy-environment/china-oil-iran-war.html
1•bookofjoe•1m ago•1 comments

Proactive Error Log Triage Agents

https://www.nishantjani.com/blog/error-log-pattern-analysis-is-hard-2/
1•nishantjani10•4m ago•0 comments

The innovators under 35 shaping climate tech

https://www.technologyreview.com/2026/09/17/1144251/innovators-shaping-climate-tech/
2•joozio•4m ago•0 comments

Show HN: Reader – I made a Mac workspace for books, browser tabs, notes, and AI

https://github.com/Marvy101/reader-source
1•marvy101•5m ago•0 comments

Does AI Assistance Enhance or Erode Expertise? Evidence from 3-Month Experiment

https://www.nber.org/papers/w35720
1•m-hodges•8m ago•0 comments

Jev example use cases from community

https://jevable.com/
1•theanonymousone•8m ago•0 comments

Checkout offered by banks and credit unions. Alternative to OneLink

https://www.paze.com/
2•dzonga•12m ago•0 comments

Montessori gave us great start. Still switched to public school for first grade

https://www.businessinsider.com/switched-from-montessori-public-school-decision-2026-9
2•theanonymousone•12m ago•0 comments

The paradox at the heart of AI and science – Terence Tao [video]

https://www.youtube.com/watch?v=svl_1upFpQo
1•lr0•13m ago•0 comments

Lawsuit: Illegal Agreement of Anthropic, OpenAI, SpaceXAI, Google on AI Slowdown

https://www.independent.co.uk/news/lawsuit-anthropic-google-openai-lawyers-b3052942.html
4•mdp2021•14m ago•0 comments

Unblock AI Shield – Non-invasive perimeter hardening with zero-disk RAM retentio

https://unblock-shield.vercel.app/?lang=en
1•tendenciaiatufu•16m ago•0 comments

My company let candidates use AI tools in interviews. Here's what I saw

https://www.reddit.com/r/EngineeringManagers/comments/1urw740/my_company_lets_candidates_use_ai_t...
1•bucket2015•17m ago•0 comments

Maximizing Return-on-Feedback

https://avivbenyosef.com/maximizing-return-on-feedback/
1•levlaz•22m ago•0 comments

Post-Quantum Cryptography for Healthcare Professionals

https://www.udemy.com/share/10fqoh3@_zy7B-GA7JTZkdnE0X0rOZnG0NE6YPPmu77H_UQmBQ1fHdvfPwlC9xJeEyAvq...
1•remopulcini•25m ago•0 comments

In 2024 I fine-tuned an LLM. Jev could have removed the side quests

https://kasra.blog/blog/classification-and-jev/
1•jc4p•26m ago•1 comments

DRAM and NAND Price Surges Set to Drive the 2026 Chip Market to a Record $1.65T

https://asiaai.fyi/dram-nand-price-surges-chip-market/
2•ghernando•27m ago•0 comments

AI agent governance patterns as executable decision tables (MIT license)

https://github.com/scubagraham/outthebox-open-patterns
1•scubagraham•28m ago•0 comments

Almost Never Use AI to Write Anything Substantive

https://erichgrunewald.substack.com/p/why-you-should-almost-never-use-ai
6•erwald•30m ago•0 comments

Uber Ordered to Pay $40M to Parents of Passenger After Driver Left Her

https://www.panish.law/2026/09/uber-ordered-to-pay-40-million-to-parents-of-emily-normandin-parke...
3•sensanaty•34m ago•1 comments

CNN, MS Now and Politico Barred from White House After Trump Announces Ban

https://www.nytimes.com/2026/09/19/business/media/trump-white-house-press-ban.html
2•layer8•35m ago•0 comments

Ask HN: ICLR went from 143 submissions to 62,301 submission IDs – what happened?

4•luxshan_t•36m ago•1 comments

Britain created Iraq to control its oil, then installed its own king [video]

https://www.youtube.com/watch?v=Dh7nJNKrDdo
2•teleforce•36m ago•0 comments

Props Are Not a Design System

https://vitonsky.net/blog/2026/09/18/design-system/
3•RohanAdwankar•36m ago•0 comments

Russia reports 'powerful' cyberattacks on second day of parliamentary vote

https://www.aljazeera.com/news/2026/9/19/russia-reports-powerful-cyberattacks-on-second-day-of-pa...
2•mikhael•37m ago•0 comments

Infillion Buys Foursquare

https://app.dealroom.co/news/note/infillion-buys-foursquare-adding-location-data-to-its-ad-platform
4•edent•38m ago•0 comments

A Machine That Can Have Grandchildren

https://artemandreenko.com/blog/a-machine-that-can-have-grandchildren/
2•miovoid•42m ago•1 comments

Show HN: Built a local guardrail layer for Claude Code

https://github.com/ioni-dev/mati
1•fennect•43m ago•0 comments

Regolith Desktop status updates Sep 2026

https://regolith-desktop.com/posts/status_update_09_26/
1•thinkmassive•45m ago•0 comments

Trump announces agreement to secure 'permanent' control over Greenland security

https://www.nbcnews.com/politics/trump-administration/trump-announces-agreement-denmark-secure-pe...
3•ijidak•45m ago•0 comments