A fundamental principle of pain management is to determine the distribution and causes of pain. However, relevant data among postoperative cancer patients based on a large amount of data remain sparse. We aimed to investigate the incidence of postoperative pain in cancer patients and to explore the associated risk factors. We retrospectively collected information on postoperative pain-evaluation records of cancer patients who underwent surgery between 1 January 2014 and 31 December 2019. Descriptive statistics were presented, and multinominal logistic regression analysis was performed to explore the risk factors associated with postoperative pain. Among the 11,383 patients included in the study, the incidence of mild/moderate to severe pain at the 24th hour after surgery was 74.9% and 18.3%, respectively. At the 48th and 72nd hour after surgery, the incidence of mild pain increased slightly, while the incidence of moderate to severe pain continued to decrease. Female patients experienced a higher risk of pain (ORs: 1.37-1.58). Undergoing endoscopic surgery was associated with a higher risk of pain (ORs: 1.40-1.56). Patients with surgical sites located in the respiratory system had a higher risk of pain compared to in the digestive system (ORs: 1.35-2.13), and other patients had a relatively lower risk of pain (ORs: 0.11-0.61). The majority of cancer patients experienced varying degrees of postoperative pain but may not receive adequate attention and timely treatment. Female, young age and endoscopic surgery were associated with increased pain risk, and effective identification of these high-risk groups had positive implications for enhanced postoperative pain management.