ACSS2 and Cognitive impairment: Here, we report that (1) chronic postsurgical pain causes cognitive behavioral deficits in rats, (2) the gut SCFA-producing microbiome mediates pain-related cognitive impairments, and (3) SCFA consumption alleviates chronic postsurgical pain–induced cognitive deficits by improving histone acetylation and synaptic transmission via the ACSS2-HDAC2 axis.