The example below uses the database named netbox so change as needed. It gets a list of the tables in the database and for each one performs a full vacuum and analyze. There is probably a more efficient way to do this from the psql prompt but this is what worked for me:
su - postgres for TABLE in $(psql -d netbox -c "\dt" | grep table | awk -F "|" '{print $2}' | tr -d " "); do psql -d netbox -c "VACUUM FULL ANALYZE VERBOSE $TABLE" ; done