Mental health disorders can occur in patients with pain conditions, and there have been reports of an increased risk of persistent pain after THA and TKA among patients who have psychological distress. Persistent pain may result in the prolonged consumption of opioids and other analgesics, which may expose patients to adverse drug events and narcotic habituation or addiction. However, the degree to which preoperative use of antidepressants or benzodiazepines is associated with prolonged analgesic use after surgery is not well quantified. (1) Is the preoperative use of antidepressants or benzodiazepine medications associated with a greater postoperative use of opioids, NSAIDs, or acetaminophen? (2) Is the proportion of patients still using opioid analgesics 1 year after arthroplasty higher among patients who were taking antidepressants or benzodiazepine medications before surgery, after controlling for relevant confounding variables? (3) Does analgesic drug use decrease after surgery in patients with a history of antidepressant or benzodiazepine use? (4) Does the proportion of patients using antidepressants or benzodiazepines change after joint arthroplasty compared with before? Of the 10,138 patients who underwent hip arthroplasty and the 9930 patients who underwent knee arthroplasty at Coxa Hospital for Joint Replacement, Tampere, Finland, between 2002 and 2013, those who had primary joint arthroplasty for primary osteoarthritis (64% [6502 of 10,138] of patients with hip surgery and 82% [8099 of 9930] who had knee surgery) were considered potentially eligible. After exclusion of another 8% (845 of 10,138) and 13% (1308 of 9930) of patients because they had revision or another joint arthroplasty within 2 years of the index surgery, 56% (5657 of 10,138) of patients with hip arthroplasty and 68% (6791 of 9930) of patients with knee arthroplasty were included in this retrospective registry study. Patients who filled prescriptions for antidepressants or benzodiazepines were identified from a nationwide drug prescription register, and information on the filled prescriptions for opioids (mild and strong), NSAIDs, and acetaminophen were extracted from the same database. For the analyses, subgroups were created according to the status of benzodiazepine and antidepressant use during the 6 months before surgery. First, the proportions of patients who used opioids and any analgesics (that is, opioids, NSAIDs, or acetaminophen) were calculated. Then, multivariable logistic regression adjusted with age, gender, joint, Charlson Comorbidity Index, BMI, laterality (unilateral/same-day bilateral), and preoperative analgesic use was performed to calculate odds ratios for any analgesic use and opioid use 1 year postoperatively. Additionally, the proportion of patients who used antidepressants and benzodiazepines was calculated for 2 years before and 2 years after surgery. At 1 year postoperatively, patients with a history of antidepressant or benzodiazepine use were more likely to fill prescriptions for any analgesics than were patients without a history of antidepressant or benzodiazepine use (adjusted odds ratios 1.9 [95% confidence interval 1.6 to 2.2]; p < 0.001 and 1.8 [95% CI 1.6 to 2.0]; p < 0.001, respectively). Similarly, patients with a history of antidepressant or benzodiazepine use were more likely to fill prescriptions for opioids than patients without a history of antidepressant or benzodiazepine use (adjusted ORs 2.1 [95% CI 1.7 to 2.7]; p < 0.001 and 2.0 [95% CI 1.6 to 2.4]; p < 0.001, respectively). Nevertheless, the proportion of patients who filled any analgesic prescription was smaller 1 year after surgery than preoperatively in patients with a history of antidepressant (42% [439 of 1038] versus 55% [568 of 1038]; p < 0.001) and/or benzodiazepine use (40% [801 of 2008] versus 55% [1098 of 2008]; p < 0.001). The proportion of patients who used antidepressants and/or benzodiazepines was essentially stable during the observation period. Surgeons should be aware of the increased risk of prolonged opioid and other analgesic use after surgery among patients who were on preoperative antidepressant and/or benzodiazepine therapy, and they should have candid discussions with patients referred for elective joint arthroplasty about this possibility. Further studies are needed to identify the most effective methods to reduce prolonged postoperative opioid use among these patients. Level III, therapeutic study.