I have seen many doctors, including sleep specialists, regarding insomnia. They all pointed to one source as the reason for the sleep issues: stress. And they all wanted to put me on prescription sleeping pills. I said no to that. Sleeping pills can cause dependence, and they often treat the symptom rather than the underlying cause. As a software developer, I am used to finding and fixing the underlying problem instead of relying on the quick fixes these doctors were offering me.
After much research, I figured out what I believe was the underlying problem, and the fix for it. The underlying problem was magnesium deficiency. As a software developer, I spend much of the day doing mentally demanding work. This is the kind of stress the doctors were talking about. Stress can increase the body's demand for magnesium and may contribute to low magnesium levels.
The cells in our body depend on minerals such as calcium and magnesium for normal function. In muscle and nerve cells, calcium helps switch the cell into an active state, while magnesium helps keep that activation under control and supports the return to a resting state. When you are low on magnesium, your muscles may remain tense and your nervous system may have a harder time settling down. That can contribute to muscle stiffness and difficulty sleeping.
The solution, in my case, was magnesium supplements. They fixed my muscle stiffness issues and my sleep issues. A special form of magnesium called magnesium L-threonate may be especially helpful for the brain because it appears to raise brain magnesium levels more effectively than some other forms.
I found gwern's take on Melatonin interesting: https://gwern.net/melatonin
A small excerpt:
> One might object that they do not wish to tamper with their natural sleep, even if melatonin is a normally-secreted hormone.
> Sad to say, I would point out to such readers that they are already profoundly tampering with their natural sleep cycle, and indeed, all of Western civilization is tampering with it; most of my readers do not even sleep multiple times during the day, as ‘Nature intends’ and as humans have usually slept through history, but rather in a single 7–9 hour long block.
> [...]
> Finally, there are multiple lines of research suggesting chronic sleep deprivation is prevalent among young adults (including historical comparisons). It is striking that unemployed adults sleep a full hour longer than the employed , and that when normal adults are placed in settings without artificial light like camping or without any time indicators, they sleep longer than before - exactly as if they were sleep deprived.
> There are few to no side-effects to melatonin use in adults (there is uncertainty about the risks & benefits in children & adolescents28), and it is not addictive or habit-forming like caffeine is. The usual dose for a night is 0.5-3 mg and I take 1.5mg [29]; my dose is highly likely to be too high. High doses may well be responsible for why some people try melatonin and report that it does nothing or hurts them, since in one study, the best dose for old people was 10x smaller (0.1mg or 0.3mg) and for one blind person, 0.5mg [30 31 32] . Zhdanova et al 1996 found 0.3mg & 1.0mg to affect sleep onset similarly. A study of delayed-release melatonin found with their high dose of 4mg (but not 0.4mg) elevated melatonin levels 10 hours after bedtime ( Gooneratne et al 2011) - potentially interfering with waking time.
It is difficult to find doses as small as 1mg sublingual (dissolve under the tongue) in my area. Everyone is trying to sell you 5-30mg chewables. And, I expect everyone is buying them under the assumption that more is better. But, here it explicitly is not.
The way melatonin works well for me is to wait until I'm already settled into bed and should be asleep, but I'm not. Do a couple body scans to relax for real. Try to think about something mindless. Then if I'm still awake, pop 1mg under my tongue. I'll usually wake in the morning with half of it drooled on my pillow :P
It usually takes 15-30 minutes before I get noticeably drowsy, but I feel no more groggy the next day than if I slept sober.
I've always had insomnia since I was a kid and I just chalked it up to "being a night owl." As a teenager, I mostly solved this by living in a permanent fog during the week and "catching up" by sleeping in on the weekend. As an adult, I was suffering greatly from chronic sleep deprivation because adults (mostly) don't have much control over when they can wake up to start the day.
Around 10 years ago, I started taking 5mg melatonin. It's going to sound like I'm overselling it, but it changed my life. It _very reliably_ makes me sleepy 1-2 hours after I take it. If I forget to take it, I am fully awake until the wee hours of the morning. Is it important to note that (for me), after I take it, I have to engage in some passive activity like (calm, non-shouty) YouTube repair videos or reading. Also, the "window of sleepiness" is at most about 30 minutes and if I decide to power through it, I will come out the other side fully awake again. Melatonin does not "force" me to sleep, only highly encourages it.
I was skeptical of melatonin for the longest time. Generally, I rarely see much if any positive effect from supplements. But (for me!) this stuff really works. If anyone reading this is on the fence, I highly recommend giving it a try. (With the acknowledgement that it takes about a week to get into a solid sleep schedule if yours is currently disorganized.)
- a long uninterrupted night cycle and a short (20-60 mins) afternoon nap. Around 2pm. - a night cycle split into two halves. With a 1-2h break (maybe up to 3h) starting around midnight to 2am.
The former is still very common, and imho stretching the definition of multiple cycles. The latter is more historical (more common when there are long winter nights and no electricity).
Also making it a “Western” problem is kinda weird? There are other cultures where single cycle sleep has existed. Even hunter-gatherer groups with little to no contact with the west. And alternatively afternoon naps are still quite common is some western areas. I guess the main thing that prevent it would be the classic work day schedule.
As someone who has never been a regular coffee consumer, I really didn't want to end up with the dual dependence of melatonin at night and then caffeine in the morning.
This thread is stimulating me to want to get my magnesium checked, but barring that I've found the most effective sleep interventions are the basic ones: get some exercise earlier in the day, and don't do screens for the last few hours before bed.
The usual suggestions from doctors for first line treatment are more mild medications that have drowsiness as a side effect, prescribed at low dose. I would actually prefer many of these low dose options over some of the high dose melatonin supplements. Melatonin is a hormone and taking it can throw off natural production
The reason diphenhydramine Is associated with a slight increase in dementia risk is the anticholinergic properties. This risk increase is from correlational studies on other medications with anticholinergic medicines being taken for many years by elderly people, so the risk of taking Benadryl occasionally is low to none.
The prescription alternatives like doxepin have the same antihistamine properties without the anticholinergic properties when used at the prescribed dose.
This is an example where people can get themselves into the wrong outcome by assuming anything their doctor prescribes is a last resort quick fix, but anything they can source by themself is safer and superior.
It’s not a good idea to take Benadryl for many years, but occasional use or even for months while going through a difficult period isn’t going to cause dementia.
for people getting 7 hours of sleep you're good. Improve your sleep hygiene, ok, but artificial interventions to get 8 may not be worth it for you.
But I don't think it does anyone any favors to oversell the idea that it has "few" or "no" side effects -- it has mild side effects, most commonly reported in the literature are daytime fatigue, headaches and GI symptoms, and also nightmares. Mild doesn't mean it isn't a nonstarter for some people.
It's also important to remember that there are major gaps in what we know about melatonin; notably the effects of chronic supplementation are not well-studied, but earlier final awakening has been documented and this is quite commonly reported in anecdata -- I can contribute a datapoint there, as can most people in my circles who have used it.
To be clear, melatonin is great and useful, but as someone with a rare lifelong chronic sleep disorder who is intimately familiar with this substance, I think it's most useful when we're clear on what we know, what we don't know, and what actually are the limitations on a substance.
Just because downing a bottle of it probably won't cause systemic organ failure or otherwise any kind of medical emergency in most people doesn't mean there aren't tradeoffs to consider when using it, especially if you are sleep-challenged
I tried magnesium before but didn’t see any effects after a week so threw in the towel. Then I read a comment by someone here that had the exact same symptoms as me (brain wouldn’t turn off), explained the underlying cause, suggested L-threonate, and explained that it’s a long-term deficiency and might take some time to build up sufficient reserves.
I have had insomnia my entire life, since I was a child. I would go to bed around midnight and fall asleep at 3am, if I was lucky. I simply could not get my brain to disengage.
Within a month of supplementation, I thought I noticed a bit of improvement. By two months, my insomnia was gone. Not better. Gone. I fall asleep within minutes now.
I also find sauna before bed is good. I have a bed chiller so I can crank up the sauna before bed and not sweat a lot. Generally if I sauna and take the aforementioned supplements I sleep well. Exercise also seems to help me out a lot. If I exercise during the day, and a 4-5 times that week in general, I tend to sleep well.
Funny how it's basically do all the things you're supposed to do - exercise, diet, stress management - then sleep is then easier.
I dont have problems normally, just cant sleep in high altitude, 3000m is already showing mild effects. Guess what, I do/did quite a bit of mountaineering, its easy to get above 5000m in himalayas, highest I've been in tent attempting to sleep before summit push was 6000m on Aconcagua. Tried both Mg and melatonin up there over multiple nights, 0 improvements. I had highest O2 blood level measured in 5500m by doctor (mandatory there) from whole group.
Physical effort makes better sleep for literally everybody, thats age old knowledge and I havent met a single exception yet.
I'm skeptical that avoidance of "relying on the quick fixes" generalizes to software developers as a whole :)
Which type, if you don't mind my asking? And how long did it take before you felt the benefits? I took it for a month once (forget which type) an hour before bed and nothing changed.
I've not noticed any significant difference between the other two.
Much more deep sleep with Glycinate, some folks don’t like it because they feel too groggy after waking.
Oddly, it has the opposite effect as sleeping pills on me, it doesn't make me sleep more but I'm more rested when I wake up. It even happened a few times that I only slept 5 hours but still could focus well at work and bike intensively for an hour in the evening, without glycine that was impossible.
At 20 euro/kg I think I'll take it for the rest of my life, and it probably will add a few years to my life.
The study that made this claim was performed by the person who patented magnesium L-threonate and sells it at a high price. They go after any company that tries to sell cheap generic versions. The study was in mice and only showed small increases.
Magnesium L-threonate doesn’t get absorbed into your body and go into your brain as a lot of the supplement podcasts and social media posts have been implying. Magnesium supplements like this dissociate into their components in your digestive tract. Magnesium and threonate get absorbed separately. So if magnesium L-threonate has some special properties, it would be because threonate does something to improve absorption or maybe has other effects in the body, but that’s a big if. Remember that the person claiming it works better has been making a lot of money off of that one study.
If you have the cash and don’t mind paying the price then there’s no reason to switch. Many people find that magnesium glycinate, which is cheap, works just as well if not better. Glycine supplementation has been found independently to improve sleep, so taking a magnesium supplement that dissociates into magnesium and glycinate might be helpful in its own way.
Magnesium builds up in the body. Some people are deficient and get strong effects from initially correcting the deficiency. Take high doses for too long and you can start accumulating enough to get into excessive magnesium range, which brings problems. That was previously a rare observation but it’s occurring more as people get into magnesium supplements from podcasts that encourage constant high dose protocols and repeat claims that everyone is severely deficient. Keep the dose moderate.
> And they all wanted to put me on prescription sleeping pills. I said no to that. Sleeping pills can cause dependence, and they often treat the symptom rather than the underlying cause. As a software developer, I am used to finding and fixing the underlying problem instead of relying on the quick fixes these doctors were offering me.
“Sleeping pills” could mean a lot of things. Few doctors will put a patient on long-term hypnotics with high dependence liability like Ambien in the 2020s. Most doctors are hesitant to prescribe them at all in the current environment, and when they do it’s short term. I would be very surprised if you went to multiple doctors who offered to prescribe you something like that as a new patient without a complicated history. Even the people with significant long term insomnia complain about how hard it is to get doctors to prescribe those.
What they usually recommend is weaker medications with somnolence as a side effect, but the effect is weaker and doesn’t target pathways prone to addiction. Trazodone, doxepin, and a few others are common. These are not in the same category as what people think of as “sleeping pills” like Ambien that have higher dependence and addiction liability. They should not be dismissed together as one big category of drugs that are all bad for you.
There were some generic versions available but the Magtein people go after them. They have to in order to protect their cash cow until the patent expires.
I think this is just what happens if you read a lot of supplement forums and listen to the supplement podcasts a lot: You start developing elevated beliefs about the supplements, disdainful beliefs about doctors, and think you’re making superior choices having done your own research. That last point is some times critical for the supplements working, because if you believe you’re taking something special after having cracked the mystery by listening to 50 hours of Huberman or Rhonda Patrick (as examples) then the placebo effect will supercharge the result. Having belief that you’ve solved the problem makes the effects much stronger, especially for cases like this where the underlying problem was already pointed out as being stress related.
Hmmmmmmm
People sharing their experience doesnt immediately mean AI-generated advert
"Health" and more specifically the supplement industry is just a revolving door of fads. There's also survivorship bias, those who are obvious get banned quickly.
I did it recently and found out basically all my b vitamins were in the toilet along with my vitamin D level. I started taking a b complex vitamin and D3 supplement and found immediate improvements to brain fog and exhaustion.
The Magnesium RBC Test measures magnesium inside red blood cells, providing a more accurate assessment of magnesium status than serum tests.
When a serum Mg test comes out low, the patient already has severe deficiency and visible symptoms, so isn’t very useful unless you’re investigating a systemic issue.
As explained by my endocrinologist.
Or is there a "maximum low level deficit" which you will never leave with just eating the right stuff?
(Like VitamineD deficit - it can get so low, that you cant fix it by "just going more into the sun")
Doing a quick search for magnesium-rich foods, it seems like it would take either an unsustainable focus on eating these foods to see results on a similar timeline or an extremely prolonged timeline to see similar results.
That said, I am not a doctor or nutritionist. But my instinct is that you can get so far in the hole with a lifetime of magnesium deficiency that supplementation is by far the most time- and lifestyle-efficient to digging yourself out. Whether or not switching to magnesium-rich foods can sustain you being at correct levels will end up depending on what the size of the deficit was in the first place, but is probably worth a try.
For me, avoiding high histamine foods as well as histamine liberators had helped tremendously.
The theory:
Anti-histamines like Benadryl make you sleepy by blocking histamine.
Well, instead of blocking the histamine, get rid of it in the first place by avoiding histamine foods (for example aged or preserved meats).
The brain histamine in your neurons is primarily synthesized from an amino acid. The histamine levels in neurons are different than the levels in mast cells.
There are a lot of degrees of hand waving in your theory that don’t work.
As a software developer, I am a much better doctor than actual trained doctors, and am definitely immune to any placebo effects.
I don’t know what people think you learn in medical school that makes you an infallible source of health knowledge.
The problem is not with evidence-based medicine itself, but with how the evidence is generated. The gold standard of medical evidence--a large, randomized, double-blind clinical trial--is extraordinarily expensive. In practice, much of this research is funded by private industry, which must have a reasonable expectation of earning a return on its investment. That naturally directs research toward treatments that can be patented, commercialized, and sold at a profit.
This creates a structural blind spot. Many naturally occurring compounds cannot be patented in their natural form, making it difficult to justify the enormous cost of conducting the kind of trials that modern medicine demands. As a result, potentially useful natural therapies often remain under-studied, not because they have been proven ineffective, but because the economic incentives to investigate them are weak.
This is the reason your doctor is much more likely prescribe Ambien CR than to suggest trying magnesium supplements.
Do you know they’re wrong? Please don’t invoke Dunning Kruger like this, it’s cliché and also wrong to do. There’s no indicator for whatever it is Dunning & Kruger showed, you cannot know if it applies to a single person. Their main plot showed a positive correlation between confidence and competence. Their paper has problems, their methodology has been rightly questioned, and some attempts to reproduce have failed. Plus keep in mind that, ironically, for people who are intimately familiar with the debate over DK, using it to essentially name-call someone backfires and has the opposite of the intended effect, it makes the name caller look confidently ignorant.
I don't know what the hell I was taking too much of, but I didn't have a good way to test it. I wish the body had some indicators.