Melatonin is a hormone primarily released by the pineal gland at night, and has long been associated with control of the sleep–wake cycle. As a dietary supplement, it is often used for the short-term treatment of insomnia, such as from jet lag or shift work, and is typically taken by mouth. Evidence of its benefit for this use, however, is not strong. A 2017 review found that sleep onset occurred six minutes faster with use, but found no change in total time asleep. The melatonin receptor agonist medication ramelteon may work as well as melatonin supplements, at greater cost but with different adverse effects, for some sleep conditions.Side effects from melatonin supplements are minimal at low doses for short durations. They may include somnolence (sleepiness), headaches, nausea, diarrhea, abnormal dreams, irritability, nervousness, restlessness, insomnia, anxiety, migraine, lethargy, psychomotor hyperactivity, dizziness, hypertension, abdominal pain, heartburn, mouth ulcers, dry mouth, hyperbilirubinaemia, dermatitis, night sweats, pruritus, rash, dry skin, pain in the extremities, symptoms of menopause, chest pain, glycosuria (sugar in the urine), proteinuria (protein in the urine), abnormal liver function tests, increased weight, tiredness, mood swings, aggression and feeling hungover. Its use is not recommended during pregnancy or breastfeeding or for those with liver disease.In vertebrates, melatonin is involved in synchronizing circadian rhythms, including sleep–wake timing and blood pressure regulation, and in control of seasonal rhythmicity including reproduction, fattening, moulting and hibernation. Many of its effects are through activation of the melatonin receptors, while others are due to its role as an antioxidant. In plants, it functions to defend against oxidative stress. It is also present in various foods.Melatonin was discovered in 1958. It is sold over the counter in Canada and the United States; in the United Kingdom, it is a prescription-only medication. It is not approved by the US Food and Drug Administration (FDA) for any medical use. In Australia and the European Union, it is indicated for difficulty sleeping in people over the age of 54. In the European Union, it is indicated for the treatment of insomnia in children and adolescents. It was approved for medical use in the European Union in 2007.