Endoscopic submucosal dissection (ESD) is an effective treatment for early gastric cancer or premalignant lesions in the stomach. ESD enables en bloc resection of gastrointestinal neoplasms, increases the rates of histologically complete resections, and also reduces local recurrence rates. Despite these advantages, ESD is thought to induce various complications. Wellknown ESD-related complications include perforation, postoperative bleeding, or stricture. In addition, minor adverse events after ESD are also commonly noticed. Pain is one of these frequently noticed minor ESD related complications, is the main reason for prolongation of the hospital stay, and is related to patients' compliance; however, there is a tendency to neglect or underestimate post-ESD pain. The causes of pain associated with ESD are thought to be associated with transmural burn or transmural air leak. Some studies have tried to control localized pain during and after ESD using local lidocaine, single dose postoperative intravenous dexamethasone or a transdermal fentanyl patch. Magnesium has been reported to alter the perception and duration of pain and produce important analgesic effects. It is included the suppression of neuropathic pain, potentiation of morphine analgesia, and attenuation of morphine tolerance. Although the exact mechanism is not yet fully understood, the analgesic properties of magnesium are believed to stem from regulation of calcium influx into the cell and antagonism of N-methyl-D-aspartate receptors in the central nervous system. Also, magnesium may prolong neuromuscular blockade after administration of neuromuscular blocking drugs, increase sedation and contribute to serious cardiac morbidity. And magnesium as a hypotensive anaesthesia technique supply objectively better operative field, reduction in the duration of surgery and reduced blood loss. There have been no previous trials on the use of magnesium specifically for pain control following ESD. Thus, the purpose of this study was to assess the efficacy of intravenous magnesium for pain relief after ESD.