If you've ever had a Charley horse, you know how painful these can be - especially if these occur late at night while you're sleeping. A Charley horse is a colloquial name for a muscle spasm or contraction. And although these can happen anywhere in the body, most people get them in the legs. The spasm is often intense - the pulling of the muscle in the calves can sometimes be visible on the skin surface! Fortunately, the episodes only last for several seconds.
But what causes Charley horses? Muscle spasm can be brought on by a number of things, including lack of adequate blood flow, muscle stress from exercise, and an imbalance of metabolites like sodium, potassium, calcium. So, it's possible that an awkward position during sleep could trigger the muscle to contract severely.
Usually, these episodes resolve on their own, although people may experience soreness afterwards. When exercise is the culprit, massaging and adequate stretching seems to be helpful. Eating and drinking enough electrolytes can also help people to avoid these painful cramps.