In addition, we found the inverse association between magnesium intake and risk of vitamin D deficiency primarily occurred in those who had the highest or the lowest tertile of PTH level; while the inverse association between total magnesium intake and vitamin D insufficiency primarily appeared among populations at high risk of vitamin D insufficiency. Here, PTH is linked to vitamin D deficiency.