The impact of glucocorticoid use on mortality risk in pneumonia patients remains unclear. This study aimed to investigate the relationship between the accumulated dose of glucocorticoids (ADG) and secondary pneumonia mortality risk among patients receiving oral or intravenous glucocorticoids. Data from the DRYAD database were analyzed, covering pneumonia patients from six academic hospitals over a 5-year period who had been administered oral or intravenous glucocorticoids. Piecewise linear regression and multivariate regression analysis were utilized to assess the association between ADG and mortality risk in pneumonia patients, while adjusting for potential confounders. Among the 628 pneumonia patients included, the 30-day mortality rate was 23.1% and the 90-day mortality rate was 26.4%. In the high-dose glucocorticoid group (≥24mg/day of methylprednisolone or an equivalent glucocorticoid within 30 days before admission), the 30-day and 90-day mortality rates were 31.2% and 35.9%, respectively. Piecewise linear regression analysis demonstrated a non-linear relationship between ADG and mortality risk in pneumonia patients. Multivariate regression analysis revealed a significantly lower mortality risk in patients receiving an ADG of 20-39g methylprednisolone compared to those receiving lower (<20g) or higher doses (≥40g), after adjusting for potential confounding factors. Additionally, in the high-dose glucocorticoid group, surpassing the inflection point of 20g of methylprednisolone raised the 30-day and 90-day mortality risks (adjusted odds ratio, 95% confidence interval: 1.16, 1.03-1.30 and 1.23, 1.07-1.42, respectively). Notably, this threshold effect was observed exclusively in male patients. This study provides evidence supporting a potential threshold effect between ADG and mortality risk in oral or intravenous glucocorticoid users with secondary pneumonia. Specifically, male patients receiving high-dose glucocorticoids should undergo close monitoring when the ADG of methylprednisolone exceeds 20g, as it may be associated with an elevated risk of mortality.