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?

Porting from Delphi to JavaScript, will unalive your blog from Delphi RSS Sites

https://delphinightmares.substack.com/p/porting-from-delphi-to-js-will-unalive
1•deeaceofbase•3m ago•1 comments

Show HN: FactIQ – a realtime econ+finance database for AI agents

https://github.com/defog-ai/factiq-plugin
1•rishsriv•4m ago•0 comments

Economics Nobel Prize 2025: Understanding Innovation-Driven Growth

https://visionias.in/blog/english/economics-nobel-prize-2025-understanding-innovation-driven-growth
1•akbarnama•5m ago•0 comments

We won $92,337 bug bounty using a single kernel 0-day

https://nebusec.ai/research/ionstack-part-2/
3•etenal•6m ago•1 comments

The Greatest Entrepreneurs in U.S. History, According to Business Historians

https://www.wsj.com/business/entrepreneurship/best-entrepreneurs-us-history-23c83c23
1•tzury•9m ago•0 comments

Meta says it's facing $1.4T in penalties in teen mental health case

https://nypost.com/2026/07/07/business/meta-says-its-facing-1-4t-in-penalties-in-teen-mental-heal...
2•NewCzech•10m ago•2 comments

Show HN: Ghostmeet – Self-hosted meeting transcription and summaries

https://ghostmeet.sshlab.dev/
2•swq115•15m ago•2 comments

LineageOS Statistics

https://stats.lineageos.org
1•pentagrama•15m ago•0 comments

How did Windows 95 decide that a setup program ran?

https://devblogs.microsoft.com/oldnewthing/20260707-00/?p=112508
2•soheilpro•19m ago•0 comments

Multigres Supports Listen/Notify Across Pooled Connections

https://multigres.com/blog/listen-notify
1•kiwicopple•20m ago•0 comments

Understanding how search engines work – and how we got here

https://www.searchengines.net/
1•bhartzer•22m ago•0 comments

Show HN: Plagiarism.Free – Free Plagiarism Checker

https://plagiarism.free/
1•nadermx•24m ago•0 comments

Show HN: FrankenMarkdown, Render .md Files to PDF/HTML (also in browser)

https://github.com/Dicklesworthstone/franken_markdown
1•eigenvalue•25m ago•0 comments

Tesla Home Energy Management System

https://www.tesla.com/en_ca/tesla-home
1•voisin•27m ago•0 comments

The Two Waters, one extra-dimensional

1•tintweezl•27m ago•2 comments

Mushroom Management

https://en.wikipedia.org/wiki/Mushroom_management
4•chistev•28m ago•0 comments

ICE sent officers to a man's home over an email. Now he's suing

https://apnews.com/article/ice-lawsuit-free-speech-first-amendment-immigration-7c02685c16e4b141be...
4•johnnyApplePRNG•29m ago•0 comments

Using Linux tc to limit the outgoing bandwidth of a web server

https://utcc.utoronto.ca/~cks/space/blog/linux/TcLimitServiceBandwidth
3•LorenDB•30m ago•0 comments

SmolMail: An AI agent for Gmail that answers in visuals, not walls of text

https://smolmail.com/
2•narinluangrath•43m ago•1 comments

Path to Google's #1 Position

https://mysevenstars.com/articles/SEO-Google-top-rank.html
3•rajkverma123•44m ago•1 comments

EU plan to address the risks and opportunities of advanced AI for cybersecurity

https://commission.europa.eu/news-and-media/news/new-eu-plan-address-risks-and-opportunities-adva...
2•rstagi•46m ago•0 comments

Probabilistic "Copies" in Generative AI Models [pdf]

https://download.ssrn.com/2026/7/6/7067878.pdf?response-content-disposition=inline&X-Amz-Security...
2•droidjj•48m ago•0 comments

Show HN: Chiptune Radio

https://chiptune-radio.alephvoid.com/
5•bootbloopers•48m ago•1 comments

Claude Fable extended to July 12

https://www.forbes.com/sites/sandycarter/2026/07/07/claude-fable-5-extends-by-five-more-days-10-m...
6•alexkkoo93•49m ago•1 comments

How to Read Postgres Explain: A Guide to Scan Types

https://www.crunchydata.com/blog/postgres-scan-types-in-explain-plans
3•craigkerstiens•1h ago•0 comments

Australia's Biggest Telco has nationwide outage

https://www.abc.net.au/news/2026-07-08/telstra-network-issues-internet-phones-live/106891206
2•a10c•1h ago•3 comments

Rlm-Workflow

https://try.works/projects#rlm-workflow
4•handfuloflight•1h ago•0 comments

China Is About to Pop the AI Bubble [video]

https://www.youtube.com/watch?v=siazPdsZHuI
4•Bender•1h ago•1 comments

From classroom to lab: Introducing turnkey lab exercises in IEEE 5G/6G Testbed

https://testbed.ieee.org/from-the-classroom-to-the-lab-introducing-turnkey-lab-exercises-in-the-i...
2•teleforce•1h ago•0 comments

Harica: Issuance and refusal to revoke TLS certificates for sanctioned entities

https://bugzilla.mozilla.org/show_bug.cgi?id=2049237
5•keydown•1h ago•0 comments