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?

Retrocodex – What Facts Have Changed Since You Graduated High School?

https://theretrocodex.com/
1•BerislavLopac•30s ago•0 comments

Text, Filters, and Now Vectors in One Postgres Index

https://www.paradedb.com/blog/filter-aware-vector-search
1•craigkerstiens•1m ago•0 comments

Hall Effect Has a New Angle

https://www.electronicdesign.com/technologies/analog/article/55419062/electronic-design-hall-effe...
1•vogu66•5m ago•0 comments

I Got Postgres into a Single Binary

https://progrium.xyz/articles/2026/single-binary-postgres/
1•craigkerstiens•5m ago•0 comments

All Delta Flights Through Atlanta Delayed as Automated System Falters

https://www.nytimes.com/2026/11/22/us/delta-flight-delays-system-outage.html
2•1659447091•5m ago•0 comments

AI Rebounding: Why Companies Are Rehiring the Workers They Cut

https://smarterarticles.co.uk/ai-rebounding-why-companies-are-rehiring-the-workers-they-cut
2•dxs•6m ago•0 comments

What Happened in Fall 2026: AI and P vs. NP

https://cacm.acm.org/blogcacm/what-happened-in-fall-2026-ai-and-p-vs-np
1•abelanger•6m ago•0 comments

AI Privacy Cloak

https://github.com/miloshke/ai-privacy-cloak
1•miloshke•7m ago•0 comments

Scrutinizing R/WritingWithAI, and Having Mixed Feelings About It

https://trialandfailure.net/scrutinizing-rwritingwithai-and-having-mixed-feelings-about-it/
1•speckx•8m ago•0 comments

Show HN: Enjoy the Silence, a software factory on a box that isn't yours

https://dmytroportianka.github.io/enjoy-the-silence/
1•DmytroPortianka•9m ago•0 comments

US releases files on suspected Bigfoot sightings in Montana and Oregon

https://www.theguardian.com/us-news/2026/nov/22/bigfoot-sighting-report-released-montana-oregon-f...
1•n1b0m•11m ago•0 comments

Assume People Are Not Interested in Your Blog Post

https://danielsada.tech/blog/assume-people-are-not-interested-in-your-blog-post/
3•dshacker•15m ago•1 comments

Fast Code Review

https://twitter.com/aidenybai/status/2124550726882136542
1•hn-aarvin•18m ago•0 comments

First Java AI Agent/Harness capable of mutating its own bytecode at runtime

https://asi.anahata.uno/ifptoasi/greenpaper.html
1•anahata•19m ago•0 comments

Startups call on Commission to salvage or scrap EU Inc proposal

https://www.politico.eu/article/eu-startup-lobby-groups-call-upon-commission-to-withdraw-eu-inc-p...
1•BerislavLopac•22m ago•0 comments

Show HN: Convert bank statements to QuickBooks or Xero files in the browser

https://statement-converter-c41.pages.dev/
1•tyrxargaar•28m ago•0 comments

Show HN: Eleria OS – A Debian 13 Based Distro with an HTML Desktop Shell

2•levithebuilder•29m ago•0 comments

From General-Purpose Software to Evolving Environments for Generating Tools

https://medium.com/@smoking2man/from-general-purpose-software-to-evolving-environments-for-genera...
1•Aldus551•32m ago•0 comments

Paris Manifesto – Against the international oligarchy

https://parismanifesto.world/en/
2•sillyfluke•33m ago•1 comments

The lottery of career success: or why you may want to bribe OpenAI

https://notnottalmud.substack.com/p/the-lottery-of-career-success-or
2•mattm•35m ago•0 comments

Weirdly accelerating space rock keeps puzzling astronomers

https://www.scientificamerican.com/article/weirdly-accelerating-space-rock-keeps-puzzling-astrono...
1•wslh•36m ago•0 comments

What Happened to Silicon Valley?

https://www.oreilly.com/radar/what-happened-to-silicon-valley/
10•greenyouse•37m ago•0 comments

How to safely work with business data in Claude

https://roow.work/blog/claude-and-your-business-data
1•arvindram03•37m ago•0 comments

"Prosaic AI alignment": 10 years later

https://www.lesswrong.com/posts/pfZWd2dLy7wRaDKYa/prosaic-ai-alignment-10-years-later
1•paulpauper•37m ago•0 comments

Metro: The Documentary on Microsoft's Boldest Design

https://www.youtube.com/watch?v=MYyyhAhHgT8
1•alexcos•37m ago•0 comments

Riemann at home – Validate the Riemann hypothesis lean proof on your computer

https://riemann-at-home.github.io/riemann-at-home/
2•tito•41m ago•0 comments

Bill Joy: Why the Future Doesn't Need Us (2000)

https://www.wired.com/2000/04/joy-2/
1•marvel_boy•41m ago•0 comments

Rated ( Ratedltd1) – TikTok [video]

https://www.tiktok.com/@ratedltd1/video/7711067267986902290
1•erezdomb•42m ago•0 comments

Show HN: A simple decision layer for coding agents

https://smarchone.github.io/signals/
1•smarch27•42m ago•0 comments

Show HN: Lanlan Jam – a multiplayer DJ booth in the browser

https://jam.lanlan.site/
1•wchest•42m ago•0 comments