All medications and supplements, including melatonin, should be discussed beforehand with the doctor who ordered the sleep study. Do not take melatonin or any other sleep aid unless instructed to do so by your healthcare provider.