BackgroundAbnormalities of serum sodium are associated with increased mortality risk in hospitalised patients, but it is unclear whether, and to what extent other factors influence this relationship. We investigated the impact of dysnatraemia on total and cause-specific mortality in the Irish health system while exploring the concurrent impact of age, kidney function and designated clinical work-based settings.MethodsA retrospective cohort study of 32,666 participants was conducted using data from the National Kidney Disease Surveillance System. Hyponatraemia was defined as < 135 mmol/L and hypernatraemia as > 145 mmol/L with normal range 135–145 mmol/L. Multivariable Cox proportional hazards regression was used to estimate hazard ratios (HR’s) and 95% Confidence Intervals (CIs) while penalised spline models further examined patterns of risk.ResultsThere were 5,114 deaths (15.7%) over a median follow up of 5.5 years. Dysnatraemia was present in 8.5% of patients overall. In multivariable analysis, both baseline and time-dependent serum sodium concentrations exhibited a U-shaped association with mortality. Hyponatremia was significantly associated with increased risk for cardiovascular [HR 1.38 (1.18–1.61)], malignant [HR: 2.49 (2.23–2.78)] and non-cardiovascular/non-malignant causes of death [1.36 (1.17–1.58)], while hypernatremia was significantly associated with cardiovascular [HR: 2.16 (1.58–2.96)] and non-cardiovascular/ non-malignant deaths respectively [HR: 3.60 (2.87–4.52)]. The sodium-mortality relationship was significantly influenced by age, level of kidney function and the clinical setting at baseline (P< 0.001). For hyponatraemia, relative mortality risks were significantly higher for younger patients (interaction termP< 0.001), for patients with better kidney function, and for patients attending general practice [HR 2.70 (2.15–3.36)] than other clinical settings. For hypernatraemia, age and kidney function remained significant effect modifiers, with patients attending outpatient departments experiencing the greatest risk [HR 9.84 (4.88–18.62)] than patients who attended other clinical locations. Optimal serum sodium thresholds for mortality varied by level of kidney function with a flattening of mortality curve observed for patients with poorer kidney function.ConclusionSerum sodium concentrations outside the standard normal range adversly impact mortality and are associated with specific causes of death. The thresholds at which these risks appear to vary by age, level of kidney function, and are modified in specific clinical settings within the health system.Supplementary InformationThe online version contains supplementary material available at 10.1186/s12882-023-03251-w.