I was told that I could sleep on my side as soon as it was comfortable, as long as I keep a pillow between my knees to keep me from "crossing the midline". I was doing this before my surgery anyway, so I'm pretty used to it. After my first operation I was able to sleep on my non-operated side very comfortably after a few days. This was good because I have a very hard time sleeping on my back and also tend to snore a lot in that position.
After my second surgery I was forced to sleep on my back because I was not ready to sleep on either of the operated sides. I bought a 6" "leg wedge", which goes under you knees and raises your feet 6". This helped a lot, and also seemed to help keep the swelling down. You can also get larger ones (I started out with 12" but it seemed like my feet were sticking straight up in the air). I still snored, though, and my wife suffered for it.
After about a week and a half I was able to start sleeping on my left side (first operated hip) for a while but it still gets uncomfortable and I can't sleep all the way through the night that way. I can also lie for a while on the right side, if I can find that one comfortable position, and also on my back with one pillow under my knees. I have to shift positions several times during the night, but I'm getting a pretty good 8 hours most nights.