In order to perform Pleroma’s flakeID update, I had to upgrade my postgres database from 9.5 to something newer. I picked 10.6 because that’s what came with Ubuntu 18.04. I used pg_upgrade which worked, but performance seemed slow.
I was not scientific about my efforts, so I don’t know which of these two commands solved my problem, but I ran:
vacuumdb -d pleroma_dev --full
reindexdb -d pleroma_dev --verbose
which happily solved the performance issues.