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?

URL in C Puzzle

https://susam.net/url-in-c.html
1•birdculture•4m ago•0 comments

Finding the grain of sand in a heap of Salt

https://blog.cloudflare.com/finding-the-grain-of-sand-in-a-heap-of-salt/
1•privacyops•6m ago•0 comments

Is psql's scripting language Turing complete? Or: Fibonacci in psql

https://www.enterprisedb.com/blog/psqls-scripting-language-turing-complete-or-fibonacci-psql
1•ingve•6m ago•0 comments

DNS Firewalling with MISP and Technitium DNS Server

https://zaferbalkan.com/technitium-misp/
1•feldrim•8m ago•1 comments

Ray Marching Soft Shadows in 2D

https://www.rykap.com/2020/09/23/distance-fields/
2•memalign•15m ago•0 comments

Git commit-based annual performance reviewer [video]

https://youtube.com/shorts/9OpklP_TtCY
1•javaskrrt•16m ago•0 comments

You Are Insignificant. That's a Good Thing

https://www.joanwestenberg.com/p/you-are-insignificant-that-s-a-good-thing
1•gpi•21m ago•0 comments

The High Price of Environmental Responsibility

https://rodgercuddington.substack.com/p/the-high-price-of-environmental-responsibility
2•freespirt•23m ago•1 comments

An LED panel that shows the aviation around you

https://github.com/AxisNimble/TheFlightWall_OSS
1•yzydserd•24m ago•0 comments

Artificial muscles, or Robotics 2.0 (RU) (Anthropomorphic robotics)

https://habr.com/ru/articles/969722/
1•chromoblob•27m ago•1 comments

iPhone Fold Will Be Creaseless and Cost $2,400, Report Says

https://www.cnet.com/tech/mobile/iphone-fold-will-be-creaseless-and-cost-2400-report-says/
1•thunderbong•27m ago•0 comments

Generative UI: A rich, custom, visual interactive user experience for any prompt

https://research.google/blog/generative-ui-a-rich-custom-visual-interactive-user-experience-for-a...
1•pramodbiligiri•27m ago•0 comments

Ask HN: Ever done large contract work?

3•ripped_britches•28m ago•1 comments

Meditation as Wakeful Relaxation: Unclenching Smooth Muscle

https://psychotechnology.substack.com/p/meditation-as-wakeful-relaxation
1•eatitraw•28m ago•0 comments

Turn Claude threads into Notion-grade assets you can trust

https://claudeai2notion.aluo.app
1•chatgpt2notion•32m ago•0 comments

Immigrations: Gestiona Tu Visa LLC exposed 67GB of immigrant's data

https://medium.com/@newschu.substack.com/immigrations-gestiona-tu-visa-llc-exposed-67gb-of-immigr...
1•khyy_•37m ago•0 comments

A Deep Dive into MCP and the Future of AI Tooling

https://a16z.com/a-deep-dive-into-mcp-and-the-future-of-ai-tooling/
1•stosssik•37m ago•0 comments

Claude Is Broken in Armenian

https://twitter.com/dyushag/status/1993143599286886525
1•ag8•37m ago•0 comments

California prosecutors used AI to file inaccurate motion in criminal case

https://www.theguardian.com/us-news/2025/nov/26/prosecutor-ai-inaccurate-motion
1•trusche•42m ago•0 comments

The Emoji Layer

https://github.com/jrecyclebin/emojilayer
1•jrecyclebin•43m ago•0 comments

Palo Alto Networks to Acquire Chronosphere (Creators of M3DB)

https://www.paloaltonetworks.com/company/press/2025/palo-alto-networks-to-acquire-chronosphere--n...
3•leo_e•43m ago•0 comments

Mixpanel Security Breach

https://mixpanel.com/blog/sms-security-incident/
10•jaredwiener•44m ago•2 comments

The Nerd Reich – Silicon Valley Fascism and the War on Democracy

https://www.simonandschuster.com/books/The-Nerd-Reich/Gil-Duran/9781668221402
4•brunohaid•54m ago•0 comments

Intellect-3: A 100B+ MoE trained with large-scale RL

https://www.primeintellect.ai/blog/intellect-3
2•meetpateltech•56m ago•0 comments

3D visualization of audio latent spaces (AI Vector Map of Audio)

https://github.com/lyramakesmusic/latent-musicvis
2•caust1c•1h ago•1 comments

Families tracked victims and survivors in real time in Hong Kong tower fire

https://www.abc.net.au/news/2025-11-27/how-families-tracked-hong-kong-fatal-fire-in-real-time-onl...
3•charlieyu1•1h ago•0 comments

Elevating Intelligence via Efficient Model and Tool Orchestration

https://arxiv.org/abs/2511.21689
2•georgehe9•1h ago•0 comments

Ask HN: How many screens do you usually work with?

1•vpaulus•1h ago•4 comments

Show HN: GitHub Activity Analytics Powered by ClickHouse

https://velocity.clickhouse.com/
2•saisrirampur•1h ago•0 comments

Agentic Learner with Grow-and-Refine Multimodal Semantic Memory

https://arxiv.org/abs/2511.21678
1•badmonster•1h ago•0 comments