OBJECTIVETo determine the effect of esketamine in patient-controlled analgaesia after hip replacement on postoperative pain and improve sleep quality in patients.STUDY DESIGNRandomised double-blind study. Place and Duration of the Study: Department of Anaesthesiology, The First Affiliated Hospital of Guangxi Medical University, from March 2021 to May 2022.METHODOLOGYThe research enrolled 72 patients who were subjected to unilateral complete hip replacement surgery utilising jointly administered universal and peripheral nerve-obstructing anaesthetics. A randomised numeric table method was used to allocate patients to either the F-D group (fentanyl combined with dexmedetomidine, n = 34) or the Es-D group (esketamine combined with dexmedetomidine, n = 38). The key outcome indicators included the time to first administration of rescue analgaesic, the dose of rescue analgaesics, and postoperative sleep quality.RESULTSBaseline characteristics did not differ between the two groups. The time until postoperative analgaesic rescue medication was considerably shorter for those in the Es-D group (p <0.05). In addition, the Es-D group used significantly fewer rescue analgaesics (p = 0.01). The PSQI score and unpleasant responses (PONV, dizziness, nightmare) did not significantly differ between the two groups (p <0.05). Nevertheless, urine retention occurred in four patients in group F-D but not in group Es-D (p <0.05).CONCLUSIONEsketamine produced better analgaesia than fentanyl with fewer side effects after surgery. However, no improvement was observed in sleep quality.KEY WORDSArthroplasty, Postoperative analgaesia, Esketamine, Sleep quality, Patient-controlled analgaesia.