Abstract
Objective
This cohort study investigated the relationship between serum magnesium levels and the incidence of acute kidney injury (AKI) in patients with acute pancreatitis (AP).
Methods
We analyzed data from the Medical Information Mart for Intensive Care IV (MIMIC-IV) database, focusing on adult AP patients (≥18 years old) with ICU stays longer than 24 h. Univariable logistic regression was used to identify key covariates. Both univariate and multivariable logistic regression models were used to evaluate the link between serum magnesium levels and AKI occurrence. A restricted cubic spline (RCS) was used to visualize the associations, and odds ratios (ORs) with 95% confidence intervals (CIs) were calculated.
Results
During hospitalization, 455 (69.1%) participants experienced AKI. After adjusting for relevant factors, higher serum magnesium concentrations were significantly associated with AKI (OR: 2.247, 95% CI: 1.234–4.091; p = 0.008). Magnesium levels between 1.6–2.6 mg/dL (OR: 1.872, 95% CI: 1.105–1.174, p = 0.020) and ≥2.6 mg/dL (OR: 3.851, 95% CI: 1.08–13.736, p = 0.038) were linked to increased AKI occurrence. The RCS curve indicated a nonlinear relationship, suggesting a potential threshold effect between serum magnesium and AKI risk.
Conclusions
Higher serum magnesium levels were found to be associated with AKI in ICU patients with acute pancreatitis. Further studies are needed to explore this relationship.
Introduction
Acute pancreatitis leads to considerable morbidity, with mortality rates reaching 30–40% in severe cases involving organ failure or pancreatic necrosis.1,2 Its primary causes include gallstones and alcohol use, and as these risk factors increase, the healthcare burden is expected to grow in the future. 3 Acute pancreatitis is an inflammatory condition of the pancreas that can range from mild to severe and is often accompanied by complications.4,5 One of the most serious complications is acute kidney injury (AKI), which significantly increases the risk of poor outcomes in AP patients.6,7 AKI represents a clinical syndrome marked by an abrupt decline in renal function, as evidenced by a decreased glomerular filtration rate.8,9 The accumulation of nitrogenous waste products and dysregulation of fluid, electrolyte, and acid‒base homeostasis potentially culminate in multisystem complications. 10 The development of AKI in AP is often linked to systemic inflammation, fluid imbalances, and impaired kidney perfusion.11,12 Identifying risk factors for AKI can help prevent its occurrence and improve patient outcomes.13–16 Magnesium, an essential mineral, supports various physiological functions, such as enzyme activation, nucleic acid stability, and protein synthesis. 17 Previous studies have shown that serum magnesium is associated with an increased risk of AKI in patients with cirrhosis, critically ill patients, or patients after cardiac surgery.18–20 However, its impact on AKI risk in AP patients remains unclear.
Our study aimed to elucidate the association between serum magnesium levels and the risk of AKI in acute pancreatitis patients admitted to the ICU via data from the MIMIC-IV database. Subgroup analyses were also conducted to explore variations across different age groups and among patients with or without severe liver disease, congestive, heart, failure or renal disease.
Methods
Data source
In this retrospective cohort study, data were extracted from the Medical Information Mart for Intensive Care-IV (MIMIC-IV, version 2.2) database, which contains deidentified health-related information from patients admitted to intensive care units at the Beth Israel Deaconess Medical Center between 2008 and 2019. 21 Xuehong Zhou obtained approval to access the MIMIC-IV database (Record ID 13701955). The study conformed to the ethical standards set forth by the Institutional Review Boards of the Massachusetts Institute of Technology and Beth Israel Deaconess Medical Center. As the data were anonymized, written informed consent was waived, and the guidelines outlined in “Strengthening the Reporting of Observational Studies in Epidemiology (STROBE)” were followed for observational research. 22
Study participants
This study focused on patients diagnosed with acute pancreatitis, identified using the ICD-9 code 5770 and various ICD-10 codes (e.g. K8500, K8502, K851, K8520, K8590, etc.) (Supplementary Table 1), who were admitted to the ICU for the first time. The eligibility criteria included patients aged 18 years or older, an ICU stay longer than 24 h, and the availability of serum magnesium measurements. Patients with missing data on magnesium, those with multiple ICU admissions, or those with an ICU stay of less than 24 h were excluded. A total of 5894 AP patients were initially identified from the MIMIC-IV database. Among these patients, 1276 were admitted to the ICU, but only 658 met the final eligibility criteria for analysis after exclusions. Specifically, 300 patients were excluded for having non-first-time ICU admissions, 167 were excluded because their ICU stays were less than 24 h, 141 were excluded due to a history of renal disease, and 12 were excluded because of missing magnesium data. The screening process of the participants is illustrated in Figure 1.

Screen process of the participants / flowchart of patient selection from 5894 acute pancreatitis cases in the MIMIC-IV database. After exclusions, 658 patients were included: 455 with acute kidney injury (AKI) and 203 without (non-AKI).
Data collection
Structured query language was used to extract the baseline characteristics of patients from the MIMIC-IV database. The data included demographic details such as age, sex, and ethnicity, as well as vital signs, laboratory results, comorbidities, and disease severity scores. The baseline characteristics were collected within the first 24 h of ICU admission and included information on the use of medical interventions. The use of diuretics, vasoactive agents, magnesium supplements, ventilators, antibiotics (details of the antibiotics used are provided in Supplementary Table 2) and renal replacement therapy (RRT) was also documented as part of the collected data. Data on the length of ICU stay and total hospital stay were also included. All the data used to characterize the AKI and non-AKI groups are presented in Table 1.
Baseline characteristics of patients.
Variable definitions and outcomes
The primary exposure variable for this analysis was the serum magnesium level. It was treated as a continuous variable and categorized into three groups: hypomagnesemia (<1.6 mg/dL), normomagnesemia (1.6–2.6 mg/dL), and hypermagnesemia (≥2.6 mg/dL), on the basis of the first measured value upon ICU admission. The main outcome variable was the incidence of AKI, which was defined according to the 2012 KDIGO guidelines. That is, an increase in serum creatinine (sCr) of at least 0.3 mg/dL within 48 h, a rise to at least 1.5 times the baseline sCr within the previous 7 days, or a urine output of less than 0.5mL/kg per hour for 6 h. If baseline sCr data were unavailable, the first recorded value after ICU admission was used as the reference. The stages of AKI were classified as follows: Stage 1, an sCr increase of ≥0.3 mg/dL or 1.5–1.9 times baseline, or urine output <0.5 mL/kg/h for 6–12 h; Stage 2, an sCr increase of 2.0–2.9 times baseline, or urine output <0.5 mL/kg/h for ≥12 h; and Stage 3, an sCr increase of ≥3.0 times baseline, sCr ≥4.0 mg/dL, initiation of renal replacement therapy, urine output <0.3 mL/kg/h for ≥24 h, or anuria for ≥12 h.
Statistical analysis
The normally distributed measurement data are presented as the means ± standard deviations (means ± SDs), and t tests were used to compare differences between groups. For nonnormally distributed measurement data, the median and quartiles were used, and the Wilcoxon rank-sum test was employed to assess group differences. Enumeration data are presented as numbers and percentages, and the chi-square test was used to compare differences between groups. Variables with less than 20% missing data were imputed via multiple imputation methods, whereas those with more than 20% missing data were excluded (Supplementary Table 3). Sensitivity analyses were conducted to evaluate the robustness of the findings before and after missing data were handled. Additionally, all analyses were independently cross-verified by researchers to ensure reproducibility and minimize errors (Supplementary Table 4). A univariable logistic regression model was established to identify potential covariates related to AKI in patients with acute pancreatitis. Both univariate and multivariable logistic regression models were subsequently employed to analyze the associations between serum magnesium levels and AKI risk. In Model 1, no variables were adjusted; Model 2 was adjusted for age, SpO2, white blood cell (WBC) count, blood urea nitrogen (BUN), creatinine, calcium, total bilirubin, and the international normalized ratio (INR). Model 3 included all variables in Model 2, along with the Charlson comorbidity index (CCI), simplified acute physiology score II (SAPS II), Oxford acute severity score (OASIS), sequential organ failure assessment (SOFA), Acute Physiology Score III (APS III), severe liver disease, and congestive heart failure. Model 4 was adjusted for all variables in Model 3 and additionally included ventilator, vasoactive drugs, antibiotics, magnesium supplementation, fluid balance, RRT and diuretics.
Restricted cubic spline (RCS) analysis was used to determine the association between serum magnesium levels and the odds ratio (OR) for AKI in patients with acute pancreatitis. Subgroup analyses were conducted by stratifying patients based on age, ethnicity, and specific complications, including congestive heart failure, severe liver disease, ventilator use, vasoactive drug use, magnesium supplementation, and diuretic use. Interaction effects between subgroups were evaluated via likelihood ratio tests to ensure a comprehensive examination of the consistency and robustness of the magnesium-AKI relationship across various clinical contexts. Analyses were performed via R software (version 4.2.2). A two-sided P value < 0.05 was considered significant.
Results
Baseline characteristics
After rigorous screening on the basis of the inclusion and exclusion criteria, a total of 658 patients with acute pancreatitis admitted to the ICU were included in this study. The overall incidence of AKI was 69.1%. The baseline characteristics of the study cohorts categorized by serum magnesium levels are presented in Table 1. The median age was 56 years (IQR: 45–69), and 364 (55.32%) patients were male. Patients with higher serum magnesium levels tended to be older and have higher potassium concentrations and serum creatinine, BUN, and total bilirubin levels than those with lower serum magnesium levels. Moreover, these patients presented a greater prevalence of comorbidities, including congestive heart failure, and severe liver disease. An increasing trend was also observed from the lowest to the highest serum magnesium categories for the APS III, CCI, SOFA and SAPS II scores. Additionally, the use of mechanical ventilation, diuretics, and vasoactive drugs was more prevalent in the highest serum magnesium group.
Univariable logistic regression analysis of AKI incidence
Serum magnesium levels were significantly associated with the risk of AKI development (Table 2). In addition, univariable analysis revealed that Age, SpO2, BUN, WBC, Calcium, Creatinine, Total Bilirubin, INR, CCI, SAPS II, OASIS, SOFA, APS III, Severe Liver Disease, Congestive Heart Failure, Ventilator, Vasoactive Drugs, Antibiotics, Magnesium Supplementation, Fluid Balance, RRT, and Diuretics were significantly related to the risk of AKI in patients with acute pancreatitis (P < 0.05).
Univariable analysis for incidences of AKI.
Multivariate logistic regression analysis of AKI incidence
After adjusting for confounding factors in the multivariable analysis (Table 3), serum magnesium levels were significantly positively associated with the risk of AKI, regardless of whether they were analyzed as continuous or categorical variables. As a continuous variable, elevated serum magnesium levels were linked to a greater risk of AKI (unadjusted OR, 2.078; 95% CI: 1.362–3.171; p < 0.001; Table 3). According to the fully adjusted model, each 1 mg/dL increase in serum magnesium was associated with a 147% increased risk of developing AKI (adjusted OR, 2.47; 95% CI: 1.08–3.74; p = 0.038; Table 3, Model 4). When AKI risk was treated as a categorical variable, there was a significant upward trend in AKI risk across the serum magnesium tertiles (p for trend < 0.05). Multivariable-adjusted analysis revealed that the odds ratios (95% CIs) for AKI were 1.872 (95% CI: 1.105–1.174; p = 0.020) for the middle tertile and 3.851 (95% CI: 1.08–13.736; p = 0.038) for the highest tertile compared with the lowest reference group (Table 3, Model 4). Among the 658 included patients, 279 cases had magnesium measurements taken prior to AKI onset. The unadjusted odds ratio (OR) for continuous magnesium levels was 2.078 (95% CI: 1.362–3.171, p = 0.014), whereas high categorized magnesium levels (≥2.6 mg/dL) showed a stronger association (OR: 8.553, 95% CI: 2.478–29.522, p = 0.001) (Supplementary Tables 5 & 6).
Association between magnesium concentrations and acute kidney injury among acute pancreatitis.
Model 1: no adjusted.
Model 2: adjusted for Age, SpO2, BUN, WBC, Calcium, Creatinine, Total Bilirubin, INR
Model 3: adjusted for model 2 plus CCI, SAPS II, OASIS, SOFA, APS III, Severe Liver Disease and Congestive Heart Failure
Model 4: adjusted for model 3 plus Ventilator, Vasoactive Drug, Antibiotic, Magnesium Supplementation, Fluid Balance, RRT, and Diuretic.
RCS regression model
The RCS model revealed a linear increase in AKI risk among acute pancreatitis patients with increasing serum magnesium levels. Adjustment factors included Age, SpO2, BUN, WBC, Calcium, Creatinine, Total Bilirubin, INR, CCI, SAPS II, OASIS, SOFA, APS III, severe liver disease, congestive heart failure, ventilators, vasoactive drugs, antibiotics, magnesium supplementation, fluid balance, RRT, and diuretics (Figure 2(a)). An analysis excluding patients receiving RRT showed consistent results after adjusting for all confounders (Supplementary Table 6, Model 4; Figure 2(b)), with similar findings observed (P for overall = 0.012, P for nonlinear = 0.147; Figure 2(b)). The RCS analysis indicates that serum magnesium levels above 1.8 mg/dL may represent a threshold for increased AKI risk.

RSC curve showing the associations between the serum magnesium concentration and AKI in acute pancreatitis patients / linear relationship between serum magnesium levels and acute kidney injury incidence. Adjustment factors included Age, SpO2, BUN, WBC, Calcium, Creatinine, Total Bilirubin, INR, CCI, SAPS II, OASIS, SOFA, APS III, severe liver disease, congestive heart failure, ventilator, vasoactive drugs, antibiotics, magnesium supplementation, fluid balance, RRT, and diuretics. (Figure 2(a)). An analysis excluding patients receiving RRT showed consistent results after adjusting for all confounders (Supplementary Table 6, Model 4; Figure 2(b)). The red line represents the estimated values, while the red shaded area indicates the corresponding 95% confidence intervals.
Subgroup analysis
We found that the risk estimates for AKI were largely consistent across all subgroups, with no significant interactions observed (all p values for interactions >0.05). In male patients, those with serum magnesium levels of 1.6–2.6 mg/dL had a greater risk of AKI than those with levels below 1.6mg/dL (OR = 2.13, 95% CI: 1.21–3.76), and the risk was even greater in those with levels ≥2.6 mg/dL (OR = 4.33, 95% CI: 1.62–11.52). Similarly, in patients without severe liver disease, those with serum magnesium levels between 1.6–2.6 mg/dL (OR = 2.26, 95% CI: 1.26–4.03) or ≥2.6 mg/dL (OR = 2.42, 95% CI: 1.31–4.47) were at increased risk of AKI. Among ventilated patients, higher magnesium levels (1.6–2.6 mg/dL and ≥2.6 mg/dL) were associated with increased AKI risk (OR = 2.12, 95% CI: 1.13–3.99 and OR = 2.68, 95% CI: 1.39–5.15, respectively). A similar trend was observed in those receiving vasoactive drugs, where a serum magnesium level of ≥2.6 mg/dL was linked to increased AKI risk (OR = 2.56, 95% CI: 1.42–4.64) (Figure 3).

Subgroup analysis of the associations between serum magnesium concentrations and acute kidney injury / risk estimates for acute kidney injury (AKI) were consistent across all subgroups, with no significant interactions (all P > 0.05). Each stratification adjusted for all confounders (Table 3, Model 4), except for the stratification factor itself.
Discussion
In this study, we investigated the relationship between serum magnesium levels and the occurrence of AKI in patients with acute pancreatitis. Our findings revealed that elevated serum magnesium levels were more common in patients who developed AKI. This pattern was consistent across various subgroups, including those without severe liver disease, those requiring mechanical ventilation, and those receiving vasoactive drugs. Unlike previous studies, our research specifically focused on acute pancreatitis patients, incorporating subgroup analyses to better understand the association between magnesium levels and AKI. These results suggest that serum magnesium levels may reflect underlying clinical conditions associated with AKI in this patient population.
In the present study, acute pancreatitis patients with AKI had worse outcomes, including longer hospital stays (14.74 vs. 7.74 days, P < 0.001) and ICU stays (4.56 vs. 1.90 days, P < 0.001). Mortality was significantly greater in the AKI group than in the control group in both the hospital (15.82% vs. 2.96%, P < 0.001) and the ICU (10.99% vs. 0.99%, P < 0.001). Therefore, we aimed to investigate the association between serum magnesium levels and AKI. To better understand the risk of AKI associated with serum magnesium levels, we conducted subgroup analyses, focusing on patients whose magnesium measurements were taken before the onset of AKI. Our additional analyses revealed that both continuous and categorized magnesium levels were associated with AKI risk in unadjusted models. Specifically, high categorized magnesium levels (≥2.6 mg/dL) (Supplementary Tables 5 and 6), demonstrated a strong association with AKI risk, even after adjusting laboratory parameters, comorbidities, and treatments, suggesting a potential independent association. However, the association for continuous magnesium levels lost statistical significance in the adjusted models, indicating that these factors may partly explain the observed relationship. These findings highlight the complexity of the relationship between magnesium levels and AKI, emphasizing the need for cautious interpretation in clinical contexts. While elevated magnesium levels are not necessarily causative, they may serve as indicators of disease severity or impaired clearance due to renal or liver dysfunction in acute pancreatitis patients. These findings underscore the need for further research to clarify the temporal and mechanistic relationships between magnesium levels and AKI risk.
Previous studies have shown a complex relationship between serum magnesium and AKI. A study involving ICU patients with cirrhosis demonstrated a significant association between elevated magnesium levels and increased AKI risk. 19 Similarly, in COVID-19 patients, hypermagnesemia was linked with increased incidences of AKI, respiratory failure, and mortality. 23 Hypermagnesemia has also been identified as an independent predictor of AKI in patients undergoing total aortic arch replacement, 24 and in critically ill pediatric patients, 13 elevated magnesium is associated with increased AKI risk. In line with our findings, the median serum magnesium level in acute pancreatitis patients with AKI was 1.90 mg/dL (IQR: 1.60–2.10), whereas it was 1.80 mg/dL (IQR: 1.60–2.00) in non-AKI patients. Additionally, the percentage of individuals in the highest magnesium quartile was 7.74% in the AKI group, whereas it was 1.97% in the non-AKI group. These results indicate that elevated serum magnesium levels are more common among patients who develop AKI, suggesting that higher magnesium concentrations may be associated with an increased risk of AKI in acute pancreatitis patients.
Despite this, other studies have reported a U-shaped relationship between magnesium levels and kidney outcomes, with both low and high levels linked to increased AKI risk.20,25 Moreover, magnesium has demonstrated protective effects against AKI in animal models and clinical trials.26–28 However, in our study, subgroup analysis revealed no significant differences in intraoperative magnesium supplementation (P for interaction >0.05), suggesting that further prospective trials are necessary to investigate this inconsistency.
Magnesium, the fourth most abundant mineral in the body, is essential for more than 300 enzymatic reactions and regulates ATP metabolism, protein synthesis, and cardiovascular functions. 29 Animal models have shown that hypermagnesemia exacerbates kidney injury by influencing creatinine clearance and magnesium excretion. 30 Additionally, dysregulation of the FGF23-klotho-vitamin D axis in hypermagnesemia has been linked to kidney injury in ischemia‒reperfusion models. 31 Our study revealed that patients with elevated serum magnesium levels had lower mean arterial pressure, higher lactate concentrations, and a greater need for vasopressors. These observations suggest that hypermagnesemia may exacerbate the already fragile hemodynamic stability in acute pancreatitis patients, contributing to adverse outcomes. 32 These findings further support the role of magnesium in kidney pathology, but more mechanistic studies and clinical trials are needed to fully understand these interactions.
Our study emphasizes the importance of monitoring serum magnesium levels in patients with acute pancreatitis, as elevated levels may help identify individuals at increased risk for AKI. Early identification and timely intervention could reduce the incidence of AKI and improve patient outcomes. However, it is essential to integrate magnesium monitoring with other clinical indicators to ensure a comprehensive risk assessment.
On the basis of our findings, we recommend incorporating routine serum magnesium level assessments into the early management of patients with acute pancreatitis. To better understand the relationship between hypermagnesemia and AKI, future studies should adopt longitudinal designs with repeated magnesium measurements at defined intervals (e.g. 6-h or 12-h) relative to AKI onset. Additionally, incorporating key biomarkers such as magnesium excretion rates and dynamic changes in magnesium levels could provide deeper insights into whether hypermagnesemia serves as an early marker of AKI or primarily reflects underlying renal dysfunction.
However, several limitations should be considered. First, as a retrospective cohort study, we cannot definitively establish a causal relationship between serum magnesium levels and AKI in AP patients. Second, the database lacked information on some relevant biomarkers, which may have introduced residual confounding. Third, the sample size was determined by the available data from the MIMIC-IV database, which did not undergo formal sample size calculation. Therefore, the limited sample size may affect the statistical significance of the results. Finally, lifestyle factors, which could have influenced the outcomes, were not included in the dataset. Future prospective studies are needed to validate these findings and further explore the role of magnesium in AKI development.
Conclusion
Higher serum magnesium levels were found to be associated with AKI in ICU patients with acute pancreatitis. Monitoring serum magnesium may help identify patients at increased risk, and further studies should investigate potential interventions to mitigate this risk.
Supplemental Material
sj-docx-1-sci-10.1177_00368504251319648 - Supplemental material for Serum magnesium levels and the risk of acute kidney injury in ICU patients with acute pancreatitis: A MIMIC-IV cohort study
Supplemental material, sj-docx-1-sci-10.1177_00368504251319648 for Serum magnesium levels and the risk of acute kidney injury in ICU patients with acute pancreatitis: A MIMIC-IV cohort study by Xuehong Zhou, Shoubing Jin, Dong Wu and Wantong Su in Science Progress
Supplemental Material
sj-docx-2-sci-10.1177_00368504251319648 - Supplemental material for Serum magnesium levels and the risk of acute kidney injury in ICU patients with acute pancreatitis: A MIMIC-IV cohort study
Supplemental material, sj-docx-2-sci-10.1177_00368504251319648 for Serum magnesium levels and the risk of acute kidney injury in ICU patients with acute pancreatitis: A MIMIC-IV cohort study by Xuehong Zhou, Shoubing Jin, Dong Wu and Wantong Su in Science Progress
Footnotes
Acknowledgments
We thank the researchers and participants who contributed to the MIMIC-IV database.
Authors’ contributions
Wantong Su was responsible for designing the research; Xuehong Zhou performed the data extraction and analysis; Shoubin Jin and Dong Wu contributed to the data collection and interpretation; Wantong Su drafted the manuscript and provided further interpretation of the findings. All the authors participated in the development of the article and approved the final version for submission.
Data availability statement
Declaration of conflicting interests
The authors declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Ethics approval and consent to participate
This study utilized data from the publicly available MIMIC-IV database, which contains fully de-identified and anonymized health-related data, with no personal identifiers. The database complies with the principles of the Helsinki Declaration (1975, revised in 2013) and was approved by the Institutional Review Board (IRB) of the Beth Israel Deaconess Medical Center (2001P-001699/14). The IRB assessed the collection of patient data, authorized the data-sharing project, and waived the requirement for individual informed consent.
Funding
The authors disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: This work was supported by the Nanjing Luhe District Health Science and Technology Development Project, (grant number LHYB2024011).
Supplemental material
Supplemental material for this article is available online.
References
Supplementary Material
Please find the following supplemental material available below.
For Open Access articles published under a Creative Commons License, all supplemental material carries the same license as the article it is associated with.
For non-Open Access articles published, all supplemental material carries a non-exclusive license, and permission requests for re-use of supplemental material or any part of supplemental material shall be sent directly to the copyright owner as specified in the copyright notice associated with the article.
