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

Show HN: Convert Docs to Meaningful Visuals

https://www.doc2q.com
1•rokontech•3m ago•0 comments

Ask HN: Dunkelflaute' turns off my monitor

1•bertili•7m ago•0 comments

Airbus issues major A320 recall after mid-air incident grounds planes

https://www.theguardian.com/business/2025/nov/28/airbus-issues-major-a320-recall-after-recent-mid...
1•tosh•8m ago•0 comments

Everyone Should Learn C

https://computergoblin.com/blog/everyone-should-learn-c-pt-1/
1•0x54MUR41•8m ago•0 comments

How fast can browsers process base64 data?

https://lemire.me/blog/2025/11/29/how-fast-can-browsers-process-base64-data/
2•mfiguiere•14m ago•0 comments

Self-hosting my photos with Immich

https://michael.stapelberg.ch/posts/2025-11-29-self-hosting-photos-with-immich/
1•secure•19m ago•0 comments

Acmeleaf: Simple DNS-01 ACME client

https://codeberg.org/lindenii/acmeleaf
1•todsacerdoti•21m ago•0 comments

MP resigns over allegations she duped South Africans to fight for Russia

https://www.bbc.com/news/articles/cx2dndy228xo
3•breve•25m ago•0 comments

The Slow Grind That Sets You Free

https://medium.com/@naveensky/the-slow-grind-that-sets-you-free-97abd8b9bf2c
1•naveensky•26m ago•0 comments

Show HN: Structural Genesis – structure emerging from nothing (Ø₀)

https://github.com/jengbeng/structural-genesis
1•jengbeng•30m ago•0 comments

Ask HN: How are you preparing for the impending Android sideloading changes?

2•BrenBarn•34m ago•0 comments

Show HN: VidBee – A cross-platform video downloader with RSS auto-download

https://vidbee.org
1•nexmoe•37m ago•0 comments

Extreme Go Horse Process

https://gist.githubusercontent.com/banaslee/4147370/raw/fde1036073a94af5b0ee1f3c38d96bcef63e24d7/...
1•ArcHound•39m ago•0 comments

ChatGPT prompt consumes equivalent to 10s of Netflix

https://simonwillison.net/2025/Nov/29/chatgpt-netflix/
6•makeavish•49m ago•2 comments

LLM Agents Demystified

https://github.com/Dobiasd/articles/blob/master/llm_agents_demystified.md
2•Dobiasd•51m ago•0 comments

Show HN: Created free tool for Roblox Videos

https://www.inreels.ai/tools/text-to-brainrot
1•Onekiran•54m ago•0 comments

Stanford CS230 – Autumn 2025 – Lecture 7: Agents, Prompts, and RAG [video]

https://www.youtube.com/watch?v=k1njvbBmfsw
1•vismit2000•55m ago•0 comments

KDE going all-in on a Wayland future

https://blogs.kde.org/2025/11/26/going-all-in-on-a-wayland-future/
3•dualogy•1h ago•0 comments

Corecore

https://en.wikipedia.org/wiki/Corecore
2•pizza•1h ago•0 comments

Garfield's Proof of the Pythagorean Theorem

https://en.wikipedia.org/wiki/Garfield%27s_proof_of_the_Pythagorean_theorem
3•benbreen•1h ago•1 comments

Pat Gelsinger: 'I've been called here for a purpose'– Lunch With the FT

https://on.ft.com/3LZnfeq
2•microsoftedging•1h ago•0 comments

UAPs as Coherent Field Entities

https://abacusnoir.com/2025/11/29/field-entities-not-craft/
1•agambrahma•1h ago•1 comments

Planes grounded after Airbus discovers solar radiation could impact systems

https://www.bbc.com/news/articles/c8e9d13x2z7o
3•djtango•1h ago•1 comments

Engineering.fyi

https://www.engineering.fyi/
2•Kinrany•1h ago•0 comments

Cutting C++ Exception Time by +90%? – Khalil Estell – CppCon 2025 [video]

https://www.youtube.com/watch?v=wNPfs8aQ4oo
2•aw1621107•1h ago•0 comments

Plastic can be programmed to have a lifespan of days, months or years

https://www.newscientist.com/article/2506104-plastic-can-be-programmed-to-have-a-lifespan-of-days...
8•thunderbong•2h ago•1 comments

Shopify pulls off real time 8K browser rendering on the Exosphere

https://twitter.com/pushmatrix/status/1994445450527519085
5•dsr12•2h ago•1 comments

The 'S&P 493' reveals a different U.S. economy

https://www.msn.com/en-us/money/markets/the-s-p-493-reveals-a-very-different-us-economy/ar-AA1R1VUJ
37•MilnerRoute•2h ago•6 comments

It's time for our own Space Age

https://www.thomasmoes.com/52obsessions/its-time-for-our-own-space-age
1•freediver•2h ago•0 comments

Show HN: ChikkaDB – A Translation Layer to Use SQLite as a JSON Database

https://github.com/athkishore/chikkadb-ts
4•athkishore•2h ago•0 comments