I had a knee replaced a little over a year ago and now it's better than it has been for the last 15 years, no pain and now I can balance on one leg.
It took me another 5 month before it was pain free, but it took another 3 months before I could sleep on my side without pain. Sleeping on my back was no problem but not my preference. Good luck and I hope that you get a fast recovery.