Mg or melatonin have 0 effects on me, Mg helps if I over-exercise but thats for muscles regeneration.
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.