If the issue persists despite clearing off the stale entries against the concerned builds, we need to check if the DB is having any dead tuples leading to the DB’s degraded performance. You may use the following command to identify the dead tuples (if any).
SELECT schemaname,
relname,
n_tup_ins,
n_tup_upd,
n_tup_del,
n_live_tup,
n_dead_tup,
last_vacuum,
last_autovacuum,
last_analyze,
last_autoanalyze
FROM pg_stat_all_tables
WHERE schemaname = 'public order by n_dead_tup desc;
If there are dead tuples, performing a vacuum task against the database would help. It is always recommended to perform such vacuuming task after consulting with the DBAs and during the non-business hours.
SELECT schemaname,
relname,
n_tup_ins,
n_tup_upd,
n_tup_del,
n_live_tup,
n_dead_tup,
last_vacuum,
last_autovacuum,
last_analyze,
last_autoanalyze
FROM pg_stat_all_tables
WHERE schemaname = 'public order by n_dead_tup desc;
If there are dead tuples, performing a vacuum task against the database would help. It is always recommended to perform such vacuuming task after consulting with the DBAs and during the non-business hours.