Related to this:PostgreSQL extremely slow after upgrade from 9.3 to 9.4 but trying to understand better...
My queries was slow after upgrading to Postgres Version 11.5 from 10.7
I first ran
ANALYZE on the DB but still was slow!
so I can
VACUUM ANALYZE on the DB, and was still slow...
as a last resort, I am running
VACUUM FULL ANALYZE on a table by table basis using psycopg2 with autocommit on (http://initd.org/psycopg/docs/connection.html#connection.autocommit) to be able to run it in psycopg2
one table is taking hours to do ... while I wait, I can't help but wonder what went wrong. The reduction of the query performance was mainly from UPSERT.