While it's generally agreed that chronic pain interferes with attention, researchers have found that working memory trace, or the ability to hold information while working on other tasks, is most affected.
A study group of 24 people was cognitively tested pre- and postadministration of pain medication and tested for sustained and selective attention, reading span, and spatial span. One-third of the patients didn't have memory disruption in their sustained and selective attention ability when experiencing pain. The remaining 16 patients were placed into two groups-somewhat disrupted and more disrupted.
In the two groups, pain relief had no impact on everyday attention ability, reading cognitive ability, or spatial working memory. Differences in the two groups showed up in the mirror task, which is part of the spatial span test. Patients were asked to look at a computer screen that showed random letters and determine which letters were oriented normally and which were mirror images, and then remember which direction each letter was facing. At the conclusion of the task, patients were asked to recall the directions of the letters, which relies on memory trace ability. The group that was more disrupted fared significantly worse in their memory abilities.
Source