Hi, I was wondering what is the safest pg_upgrade version upgrade distance going from 9.6 version. Do I need to go version by version or I can go from 9.6 to 15?
You can go direct. You really should go to 16 though. If nothing else, you gain lots of performance improvements and another year before your version goes EOL (end of life).
We have a very huge database(TBs) with one replication server, so we will first run the pgupgrade on the main server and then rsync to a standby replica.
I assume you mean the three-way rsync recipe in the docs.
Also, when upgrading a very big database with replication where none of the data can be allowed to be lost, is the pgupgrade into rsync approach the best one? Thanks.
Not sure about "best", it is certainly the fastest. For data loss concerns, that's where your backup system (e.g. pgBackRest) is key.