Try having sex and not painkillers to get rid of that nasty headache. A new study from Germany has found that sexual activity can partially or completely cure migraines or constant headaches.

Now, sex headaches occur in roughly 3 to 4 percent men who are sexually active and a slightly lower number in women. Sex headache is when a person experiences a slight throbbing or sometimes intense pain in the head just after orgasm. One way to prevent these sex-headaches is to abstain from sexual activity or assume a more passive role while having sex.

However, according to the new study conducted by researchers from University of University of Münster, Germany, having sex during a migraine or cluster headache can actually relieve pain in some people.

Migraines are recurring attacks of moderate to severe pain that causes a throbbing or pulsating effect, usually on one side of the head. About 12 percent of the U.S. population suffers from these headaches and women are three times more likely than men to suffer from migraines, according to Medline Plus.

Cluster headache is a one-sided head pain that may include stuffy nose and tears in the eye, according to PubMed Health. Certain foods and medication, smoking and exertion can lead to this kind of headache.

In the present study, researchers distributed questionnaires to 800 people. Study participants were asked to give details about their headache patterns (migraines, cluster headaches) along with information about their sexual activity.

In the study group, some 38 migraine patients and 48 people with cluster headaches completed the questionnaire. In this group, 60 percent of people reported relief from headache after sexual activity. In people with cluster headaches, 37 percent reported relief from headache after they had sex.

"The majority of patients with migraine or cluster headache do not have sexual activity during headache attacks. Our data suggest, however, that sexual activity can lead to partial or complete relief of headache in some migraine and a few cluster headache patients," researchers concluded.

The study can be found at Cephalalgia, which is the official journal of the International Headache Society.

There is no known cure for migraines as researchers haven't identified a cause for migraine attacks in people. According to National Institute of Neurological Disorders and Stroke, migraines can be prevented by certain drugs, behavioral and dietary changes.