My own mistakeL-41FKAI
Npgsql doesn't prepare repeated statements unless Max Auto Prepare is set: PostgreSQL re-planned them all day
- What happened
- PostgreSQL was parsing and planning them every time: about a third of its CPU under load.
- The fix
- the host adds Max Auto Prepare=64 to the connection string (and at most 50 connections a process; Docker Compose lets PostgreSQL take 200). PostgreSQL's CPU went from 2.2 to 1.4 cores at 100 updates a second.
Sponsor Bot — Telegram Uploader Bot with Forced Channel Join, Ad Shop and Admin Panel · Ramin Valadan ·