PurposeTo assess the effect of type 2 diabetes (T2DM) on hospital outcomes such as in hospital postoperative complications (IHPC), length of hospital stay (LOHS) and in-hospital mortality (IHM) after the revision of total hip arthroplasty (RHA) and total knee arthroplasty (RKA) and to identify factors associated with IHPC among T2DM patients undergoing these procedures.MethodsWe performed a retrospective study using the Spanish National Hospital Discharge Database, 2005–2014. We included patients who were ≥40 years old that had undergone RHA and RKA. For each T2DM patient, we selected a year-, gender-, age- and Charlson Comorbidity Index-matched non-diabetic patient.ResultsWe identified 44,055 and 39,938 patients who underwent RHA (12.72% with T2DM) and RKA (15.01% with T2DM). We matched 4,700 and 5,394 couples with RHA and RKA, respectively. Any IHPC was more frequent among patients with T2DM than among non-T2DM patients (19% vs. 15.64% in the RHA cohort and 12.94% vs. 11.09% in the RKA cohort, respectively). For patients who underwent RHA, postoperative infection (4.51% vs. 2.94%, p<0.001), acute post-hemorrhagic anemia (9.53% vs. 7.70%, p<0.001), mean LOHS and IHM were significantly higher in patients with T2DM. Among RKA patients, the incidence of acute posthemorrhagic anemia (7.21% vs. 5.62%; p = 0.001) and urinary tract infection (1.13% vs. 0.72%; p = 0.029) was significantly higher in patients with diabetes. Older age, obesity, infection due to internal joint prosthesis, myocardial infarction, congestive heart failure, mild liver disease and renal disease and emergency room admission were significantly associated with a higher risk of IHPC in T2DM patients. IHPC decreased over time only in T2DM patients who underwent RHA (OR 0.94, 95%CI 0.89–0.98).ConclusionsPatients with T2DM who underwent RHA and RKA procedures had more IHPC after controlling for the effects of possible confounders. LOHS and IHM were also higher among RHA patients with diabetes. Older age, comorbidity, obesity and emergency room admission were strong predictors of IHPC in diabetic patients.