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•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?

Diving into the Bun Rust rewrite [video]

https://www.youtube.com/watch?v=2AqwehBu84w
1•kissgyorgy•1m ago•0 comments

Mapping AI-enabled cyber threats: Insights from the LLM ATT&CK Navigator

https://red.anthropic.com/2026/attack-navigator/
1•berlianta•1m ago•0 comments

You Are an 'Avatar in a VR Game,' Scientist Claims

https://www.popularmechanics.com/science/a71445608/space-time-illusion-consciousness/
1•XzetaU8•2m ago•0 comments

AI and the Psychology of Cognitive Surrender

https://www.psychologytoday.com/us/blog/the-digital-self/202606/ai-and-the-psychology-of-cognitiv...
2•xenophonf•5m ago•0 comments

Raytracing Geometries in 3D Rendering

https://andeplane.github.io/Raytracing/
1•kvakkefly•5m ago•1 comments

Why GPTHuman AI Is the Best AI Humanizer?

https://gpthuman.ai/
1•karl192001•5m ago•0 comments

Ask HN: Playlist – Hit the Road

1•systemkwiat•7m ago•0 comments

Scientists Create Tiny Chip That Uses Light Instead of Electricity

https://scitechdaily.com/scientists-create-tiny-chip-that-uses-light-instead-of-electricity-to-pr...
1•01-_-•10m ago•0 comments

Zamicus+|+Dang.ai

https://dang.ai/tool/ai-marketing-intelligence-zamicus-com
1•VickyK09•11m ago•0 comments

The AI Question That No AI Person Asks [video]

https://www.youtube.com/watch?v=o9Vbvp4awQU
2•mantesso•12m ago•0 comments

PlayStation Architecture

https://www.copetti.org/writings/consoles/playstation/
2•gregsadetsky•18m ago•0 comments

Open Source Aviation Maps

https://tech.marksblogg.com/aviation-maps.html
2•marklit•20m ago•0 comments

Illegal live TV streaming in Germany grows 33% since 2022, to €2.4B loss in 2025

https://vau.net/pressemeldungen/study-reveals-annual-losses-of-e2-4-billion-from-illegal-tv-strea...
2•giuliomagnifico•21m ago•0 comments

Google must let publishers opt out of AI Search features, rules UK

https://www.theverge.com/tech/942302/google-search-ai-overviews-uk-cma-publisher-opt-out
1•SockThief•21m ago•0 comments

Exploring geospatial link between soils and national intelligence quotient

https://www.nature.com/articles/s41598-025-22539-5
1•geox•26m ago•0 comments

What we learned mapping a year's worth of AI-enabled cyber threats

https://www.anthropic.com/news/AI-enabled-cyber-threats-mitre-attack
1•surprisetalk•27m ago•0 comments

JL Collins goes global, and why that feels familiar

https://www.thehappysaver.com/blog/jl-collins-goes-global-and-why-that-feels-familiar
1•teleforce•28m ago•0 comments

You won't be talking to AI in natural language for too long

https://www.elicited.blog/posts/you-wont-be-talking-to-ai-in-natural-language-for-too-long
2•justanotheratom•30m ago•1 comments

Oils – Reviewing Our NLnet Grants After 4 Years

https://oils.pub/blog/2026/06/grants.html
1•birdculture•32m ago•0 comments

Mathematicians issue warning as AI rapidly gains ground

https://www.science.org/content/article/mathematicians-issue-warning-ai-rapidly-gains-ground
2•pseudolus•37m ago•0 comments

Redis 8.8: New array data structure, rate limiter, performance improvements

https://redis.io/blog/announcing-redis-8-8/
1•ksec•37m ago•0 comments

The empty field that wasn't

https://lsc-pagepro.mydigitalpublication.com/publication/?i=865273
1•robinhouston•42m ago•2 comments

Japan declines to join movement to ban youth from social media

https://www.asahi.com/ajw/articles/16615541
6•BaudouinVH•46m ago•2 comments

A runtime verification pipeline that reduced hallucinations from 67% to 11%

https://www.crukx.dev/
2•Shafwan_safi•47m ago•0 comments

Gödel and Turing outlined the limits of AI

https://www.heise.de/en/blog/How-Goedel-and-Turing-outlined-the-limits-of-AI-11313804.html
1•bertman•48m ago•0 comments

Build 2026: WSL improvements and the new Containers CLI and APIs

https://build.microsoft.com/en-US/sessions/DEM346
5•pjmlp•49m ago•1 comments

Embedding Tailwind Design System in Obsidian

https://alessandrofarace.com/essay/how-to-embed-design-system-obsidian
1•A-F-V16•51m ago•0 comments

Show HN: Vivix – See inside JavaScript as it executes (open source)

https://vivix.dev/
2•hlude•51m ago•1 comments

UK lawmakers call on government to ditch Palantir NHS contract

https://www.theregister.com/software/2026/06/03/uk-lawmakers-call-on-government-to-ditch-palantir...
5•beardyw•54m ago•0 comments

Google Is Quietly Buying Code from Play Store Developers to Train AI

https://www.404media.co/google-is-quietly-buying-code-from-play-store-developers-to-train-ai/
2•beardyw•55m ago•1 comments