I had something called hypnagogic jerks where I would fall asleep, but jerk myself awake like I was falling multiple times. That was very stressful and very traumatic. It led to very poor sleep for a little while. That eventually was possibly remedied by magnesium IVs. But the reason I got low in magnesium in the first place was probably due to a ketogenic diet.