One more question; on one server the Vacuum Analyze before the insert takes approx. 2min after that the same command takes 15min.
You might try a VACUUM FULL sometime when you can deal with 15min of downtime or so. Actually it would probably be longer. Perhaps the table that's taking 15min has a ton of extra dead tuples left over from the fsm settings being too low and/or vacuum being too infrequent.
Does VACUUM FULL just lock entire tables and thus cause you to essentially have downtime on that database because it doesn't respond quickly or do you actually have to shut down postgres to safely do a vacuum full?
---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match