Normally you are not allowed to sleep on your side until after 6 weeks and then you should be prepared.
I had my THR at the beginning of August. The physios and the nursing staff said it was OK to sleep on my side so long as i had cushions/pillows between my legs to support the operated leg (which will be the uppermost leg). It was slightly better than sleeping on my back, but it was really several weeks before I could sleep comfortably, even on my side. However, it passes. You know that the discomfort won't last for ever, unlike the hip and leg pain which would have persisted if you hadn't had surgery.
Also, because I was worried about the 90 degree angle thing when side sleeping I asked my physio how long I had to observe that and he said it wasn't really necessary as the chance of dislocation was very slight. Though he did say it was greater in overweight people.
I'm 16 weeks on now and I forget that I have an artificial hip, there's nothing that I want to do that I can''t do (including riding my DD's horse). It's been life changing.