Data collection and analysis Two review authors searched for studies, extracted efficacy and adverse event data, examined issues of study quality and potential bias, and performed analyses. Primary outcomes were opioid consumption and pain intensity at rest and during movement at 24 and 48 hours postoperatively. Secondary outcomes were time to first analgesic request, assessment of postoperative hyperalgesia, central nervous system (CNS) adverse effects, and postoperative nausea and vomiting. We assessed the evidence using GRADE and created a 'Summary of findings' table. Main results We included 130 studies with 8341 participants. Ketamine was given to 4588 participants and 3753 participants served as controls. Types of surgery included ear, nose or throat surgery, wisdom tooth extraction, thoracotomy, lumbar fusion surgery, microdiscectomy, hip joint replacement surgery, knee joint replacement surgery, anterior cruciate ligament repair, knee arthroscopy, mastectomy, haemorrhoidectomy, abdominal surgery, radical prostatectomy, thyroid surgery, elective caesarean section, and laparoscopic surgery. Racemic ketamine bolus doses were predominantly 0.25 mg to 1 mg, and infusions 2 to 5 µg/kg/minute; 10 studies used only S-ketamine and one only R-ketamine. Risk of bias was generally low or uncertain, except for study size; most had fewer than 50 participants per treatment arm, resulting in high heterogeneity, as expected, for most analyses. We did not stratify the main analysis by type of surgery or any other factor, such as dose or timing of ketamine administration, and used a non-stratified analysis. Perioperative intravenous ketamine reduced postoperative opioid consumption over 24 hours by 8 mg morphine equivalents (95% CI 6 to 9; 19% from 42 mg consumed by participants given placebo, moderate-quality evidence; 65 studies, 4004 participants). Over 48 hours, opioid consumption was 13 mg lower (95% CI 10 to 15; 19% from 67 mg with placebo, moderate-quality evidence; 37 studies, 2449 participants). Perioperative intravenous ketamine reduced pain at rest at 24 hours by 5/100 mm on a visual analogue scale (95% CI 4 to 7; 19% lower from 26/100 mm with placebo, high-quality evidence; 82 studies, 5004 participants), and at 48 hours by 5/100 mm (95% CI 3 to 7; 22% lower from 23/100 mm, high-quality evidence; 49 studies, 2962 participants). Pain during movement was reduced at 24 hours (6/100 mm, 14% lower from 42/100 mm, moderate-quality evidence; 29 studies, 1806 participants), and 48 hours (6/100 mm, 16% lower from 37 mm, low-quality evidence; 23 studies, 1353 participants). Results for primary outcomes were consistent when analysed by pain at rest or on movement, operation type, and timing of administration, or sensitivity to study size and pain intensity. No analysis by dose was possible. There was no difference when nitrous oxide was used. We downgraded the quality of the evidence once if numbers of participants were large but small-study effects were present, or twice if numbers were small and small-study effects likel...