frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Ask HN: How can I load test PostgreSQL but avoid changing actual data?

1•LawZiL•10mo 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•10mo 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•10mo 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•10mo 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•10mo ago
Load test against a clone instead of a DB whose contents you care about?

Has your data been leaked?

https://chromewebstore.google.com/detail/digital-shield-all-in-one/pkonihncnkmbejhhjadaognganhinnhc
1•shwn2989•16s ago•0 comments

The Downside of User Accounts

https://threema.com/en/blog/downside-of-user-accounts
1•andrew918277•33s ago•0 comments

The next $1T company will be a software company masquerading as a services firm

https://sequoiacap.com/article/services-the-new-software/
1•kaizenb•1m ago•0 comments

Show HN: Bandmeter: Per-program network usage monitor for Linux, built with GPUI

https://github.com/emamoah/bandmeter
1•emamoah•2m ago•0 comments

chDB 4.0

https://clickhouse.com/blog/chdb.4-0-pandas-hex
1•tosh•4m ago•0 comments

Avoiding Trigonometry (2013)

https://iquilezles.org/articles/noacos/
1•WithinReason•7m ago•0 comments

Fully-funded trip to Stanford from anywhere in the world

https://www.svfellow.com
1•weissbergj•8m ago•0 comments

Basic C programming facts worth knowing

https://buildsoftwaresystems.com/post/essential-c-programming-facts/
1•ThierryBuilds•9m ago•0 comments

Storing Preexisting Passwords on a Yubikey

https://dubovik.eu/blog/yubikey
1•h45x1•9m ago•1 comments

MCP server for Faker-style mock data and hosted mock endpoints for AI agents

https://jsonplace.com/docs/mcp
1•fatihmgenc•10m ago•1 comments

Solid Pine Single Bed: Durable for Long-Term Rentals

https://dreamhomestore.co.uk/collections/bed-frames
1•Stevencoles89•12m ago•1 comments

SIMD implementation and Kotlin checkcast incompatibility

https://gryt.io/til/2026-03-12-simd-kotlin-checkcast-incompatibility/
1•synapticrob•13m ago•0 comments

I made a real BMO local AI agent with a Raspberry Pi and Ollama [video]

https://www.youtube.com/watch?v=l5ggH-YhuAw
2•vinhnx•14m ago•0 comments

OpenClaw has 247k stars and no governance layer

https://www.leanmcp.com/blog/you-think-youre-using-ai
1•jialu1•14m ago•0 comments

I upgraded my BMO local AI agent's voice and brain [video]

https://www.youtube.com/watch?v=W5bdM9yIEiY
1•vinhnx•15m ago•0 comments

The Usefulness of Useless Knowledge (1939) [pdf]

https://www.ias.edu/sites/default/files/library/UsefulnessHarpers.pdf
1•bookofjoe•17m ago•1 comments

Optimizing for non-uniform memory and cache effects in Stockfish

https://anemato.de/blog/nuca
1•anematode•17m ago•0 comments

Request for developer feedback: focusgroup RFC

https://developer.chrome.com/blog/focusgroup-rfc
2•agos•22m ago•0 comments

The Film That Should Be Nominated

https://animationobsessive.substack.com/p/the-film-that-should-be-nominated
1•vinhnx•22m ago•0 comments

Wiggmap

https://wiggmap.com/
2•wiggmap•26m ago•1 comments

AI job search with voice interview coaching and deep employer research

https://www.tumblr.com/login_required/wonderfullysacredtrap
1•Uniqu•27m ago•0 comments

Show HN: Wikimetron – Surface hidden sensitivity and risk in Wikipedia

https://github.com/opinionscience/wikimetron2.0
1•hjbarraza•28m ago•0 comments

The Structure of Engineering Revolutions

https://webdirections.org/blog/the-structure-of-engineering-revolutions/
1•BerislavLopac•34m ago•0 comments

How to Send Email to Space

https://buttondown.com/blog/email-in-space
1•maguay•34m ago•0 comments

An Ode to Bzip

https://purplesyringa.moe/blog/an-ode-to-bzip/
2•Expurple•40m ago•0 comments

AI is supercharging fake work

2•rxm233•40m ago•0 comments

Open Source PLFM Radar. Up to 20Km Range

https://hackaday.io/project/205190-open-source-plfm-radar-up-to-20km-range
2•ikbdsk•41m ago•0 comments

Celebrating Interesting Flickr Technologies

https://medium.com/@brightcarvings/celebrating-flickr-technology-3c93c8ddecc2
3•steerpike•41m ago•1 comments

Display of Pattern Formation Using the Gierer-Meinhardt Model

https://itp.uni-frankfurt.de/~gros/StudentProjects/Projects_2020/projekt_fischer_mrozinski/#heading2
1•o4c•41m ago•0 comments

KindScreen – a parent-reviewed catalog of safe YouTube for kids

https://kindscreen.org/
2•marcogarces•43m ago•1 comments