Faster way of upgrading postgres to 10 from 9.5
I used a script for loading junk data in postgres. It created a lot of databases (about 500). So this was causing pg_dump to take so much time.

After populating only the relevant database (about 100 GB) I am seeing good performance (about 5 second with -k option).