High dose magnesium has been shown to be effective for migraine prophylaxis. The target dose can be 600 mg and even higher in individual cases as a single infusion, and is therefore much higher than what is normally contained in nutritional supplements.
The dose should be increased slowly. Magnesium, which the body cannot use, will be excreted without alteration. However, sometimes gastrointestinal discomfort and diarrhea can occur with these high doses. Which is also why the dose should be increased slowly.