After updating Discourse, the user bar10dr experiences intermittent 502 Bad Gateway errors when posting and accessing user profiles. Nginx logs show upstream connection timeouts, while PostgreSQL logs reveal extremely slow queries, such as a 600-second COUNT(*) on the posts table. The user suspects indexing issues and runs REINDEX DATABASE discourse and VACUUM on the database. The errors improve after vacuuming, but user profile pages still fail with 502s. The user is running PostgreSQL 15 in a shared Docker instance and is unsure if the upgrade was properly handled, referencing a guide for PostgreSQL 15 updates PostgreSQL 15 update. pfaffman suggests checking the PostgreSQL version and considering a command-line rebuild if the upgrade wasn’t fully completed. bar10dr confirms the version is 15 and notes improved performance but persistent profile-related 502s.
2025-04-29 18:48:24.709 UTC [1746] discourse@discourse LOG: זמן ריצה: 606789.911 מ״ל ביצוע בלי שם: SELECT COUNT(*) FROM "posts" WHERE "posts"."deleted_at" IS NULL
time: 606789.911 מ״ל
יש לנו הרבה פוסטים, מעט משתמשים.. מדוע זה לוקח 600k מ״ל על זה?
אתה יכול לבדוק את גרסת ה-Postgres ב-/var/discourse/shared/standalone/postgres_data/PG_VERSION – אם ביצעת שדרוג משורת פקודה, ייתכן שזה ביצע את השדרוג ואתה לא שמת לב (אבל היית צריך להפעיל את הבנייה מחדש פעמיים). אם שידרגת מواجهة האינטרנט, סביר להניח שכדאי לך לעשות את הבנייה מחדש משורת הפקודה אם מערכת ההפעלה שלך ו-Docker הם גרסאות עדכניות.