The link that I posted appears to be useless without modification. Use this instead. https://commitfest.postgresql.org/17/1542/ It feels related to my problem, even though I'm not using tablespaces.
I experience that it takes a long time (several GB of data is fetched) to use pg_rewind to do a failback when the former master has failed over to the former standby (which is now master) and is started again and very little data (like one row updated) is updated. I have upgraded to the latest version (10.5), but still think it takes equally long time. I found this bugfix (https://www.postgresql.org/message-id/flat/0A3221C70F24FB45833433255569204D1F8D6C7A@G01JPEXMBYT05) from late February this year. So would like to check if somebody knows if this fix is incorporated in standard postgreSQL, or if anybody else experience the same issue.