The title of this post is too generic and therefore somewhat misleading, because the specific type of infection examined will be sepsis: infection in the bloodstream. But assuming similar biologic defense mechanisms are in play, then what is good for sepsis is likely good for infections overall.
Jordan Kempker et al. tracked a cohort of over 30,000 US adults aged 45 and up, and discovered that the incidence of sepsis is related to the level of active vitamin D:
I used the mean values for the 5 quintiles that they reported on (the blue squares), and then I fitted a power model to the data, resulting in a coefficient of determination of 0.93 — indicating a very good fit of model to the data. Risk approximately doubles for each 10 ng/mL decrease in active vitamin D (25-hydroxyvitamin D).
But to get 97.5% of people up to these levels of active vitamin D requires more international units (IU) than previously thought. A crude estimate comes from Robert Heaney et al. by using just 3 data points:
Note how the slope of 0.0038 indicates that, to get one extra ng/mL of active vitamin D in 97.5% of all persons taking vitamin D, requires administering an extra (1/.0038=) 263 IU of vitamin D. To get a 10 ng/mL rise for 97.5% of people taking vitamin D requires giving 2,630 IU.
When these high IU levels of vitamin D intake are mapped onto the original sepsis risk graph, then you get something like this:
Notice how an intake of less than 2,000 IU per day is associated with over 10-fold risk.
Evidence suggests that people following the advice of the U.S. government by taking in somewhere from 600 IU to 800 IU of vitamin D daily are putting themselves at high risk of sepsis. Clinically significant protection from sepsis is found from getting several thousands of IUs of vitamin D per day.
Protecting 97.5% of people may require levels approaching 10,000 IU per day. The only official guideline that comes close to the above is this one that I found which referred to those at high risk of deficiency:
“A higher-dose initial supplementation with vitamin D3 at 10,000 IU daily may be needed in high-risk adults who are vitamin D deficient (African Americans, Hispanics, obese, taking certain medications, malabsorption syndrome). Once serum 25-hydroxyvitamin D level exceeds 30ng/mL, 3000 to 6000 IU/day maintenance dose is recommended.”
Reference
[low active vitamin D is an independent risk factor for sepsis] — Kempker JA, Panwar B, Judd SE, Jenny NS, Wang HE, Gutiérrez OM. Plasma 25-Hydroxyvitamin D and the Longitudinal Risk of Sepsis in the REGARDS Cohort. Clin Infect Dis. 2019 May 17;68(11):1926-1931. doi: 10.1093/cid/ciy794. PMID: 30239610; PMCID: PMC6522683. https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6522683/
[more intake of vitamin D is required than has ever been officially acknowledged] — Heaney R, Garland C, Baggerly C, French C, Gorham E. Letter to Veugelers, P.J. and Ekwaru, J.P., A statistical error in the estimation of the recommended dietary allowance for vitamin D. Nutrients 2014, 6, 4472-4475; doi:10.3390/nu6104472. Nutrients. 2015 Mar 10;7(3):1688-90. doi: 10.3390/nu7031688. PMID: 25763527; PMCID: PMC4377874. https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4377874/
[the only official guideline that came close to the estimates found above] — Vitamin D Deficiency. StatPearls [Internet]. https://www.ncbi.nlm.nih.gov/books/NBK532266/
“A higher-dose initial supplementation with vitamin D3 at 10,000 IU daily may be needed in high-risk adults who are vitamin D deficient (African Americans, Hispanics, obese, taking certain medications, malabsorption syndrome). Once serum 25-hydroxyvitamin D level exceeds 30ng/mL, 3000 to 6000 IU/day maintenance dose is recommended.”
10,000 IU presents other problems according to Mayo Clinic, known for its bias against vitamin D. I personally think 5,000 per day is sweet spot for most people for most of the year but many people can benefit from 8,000-10,000 IU during the 3-4 months with least amount of exposure to the sun.