We've been urged to avoid sun exposure because it can cause skin cancer. But those cancers are squamous and basal cell carcinomas. Those carcinomas are easily cured, and don't usually kill you. Melanoma, the truly deadly skin cancer, is more prevalent in populations with less sun exposure.
There are lots of interesting graphs on Jeff Bowles' site [^1]. He's an absolute fan of vitamin D.
^1:https://jefftbowles.com/vitamin-d3-deficiency-causes-most-hu...