Your cabin can be assigned anywhere from one minute after you book until you check in at the pier.
The old thought was that the longer it was before you knew your cabin assignment the better the chances of getting a GOOD upgrade were better. I believed that for awhile because we were upgraded to a Sky Suite on Celebrity two weeks before sailing. We had booked a standard balcony on Mercury.
However, I've heard from many people that they got to the pier only to be assigned a cabin in the category they booked.
So, you have to go with the standard wisdom. Book a guarantee in the category you will be happy with and if you aren't upgraded then there is no disappointment and if you are upgraded then it's just icing on the cake.