The International Space Fellowship published an article about the astrophysical conditions favourable for the development and survival of life. The article mentions that neither Earth nor the Sun are perfect, as our planet has a relatively short period of habitability on a cosmological timescale:
Guinan explains a surprising realisation that emerged from their work: “The Sun does not seem like the perfect star for a system where life might arise. Although it is hard to argue with the Sun’s ‘success’ as it so far is the only star known to host a planet with life, our studies indicate that the ideal stars to support planets suitable for life for tens of billions of years may be a smaller slower burning ‘orange dwarf’ with a longer lifetime than the Sun ― about 20-40 billion years. These stars, also called K stars, are stable stars with a habitable zone that remains in the same place for tens of billions of years. They are 10 times more numerous than the Sun, and may provide the best potential habitat for life in the long run”. He continues: “On the more speculative side we have also found indications that planets like Earth are also not necessarily the best suited for life to thrive. Planets two to three times more massive than the Earth, with a higher gravity, can retain the atmosphere better. They may have a larger liquid iron core giving a stronger magnetic field that protects against the early onslaught of cosmic rays. Furthermore, a larger planet cools more slowly and maintains its magnetic protection. This kind of planet may be more likely to harbour life. I would not trade though ― you can’t argue with success”.