We study the effect of the fast rotation and vertical viscosity on the lifespan of solutions to the three-dimensional primitive equations (also known as the hydrostatic Navier-Stokes equations) with impermeable and stress-free boundary conditions. Firstly, for a short time interval, independent of the rate of rotation |Ω|, we establish the local well-posedness of solutions with initial data that is analytic in the horizontal variables and only L 2 in the vertical variable. Moreover, it is shown that the solutions immediately become analytic in all the variables with increasing-in-time (at least linearly) radius of analyticity in the vertical variable for as long as the solutions exist. On the other hand, the radius of analyticity in the horizontal variables might decrease with time, but as long as it remains positive the solution exists. Secondly, with fast rotation, i.e., large |Ω|, we show that the existence time of the solution can be prolonged, with "well-prepared" initial data. Finally, in the case of two spatial dimensions with Ω = 0, we establish the global well-posedness provided that the initial data is small enough. The smallness condition on the initial data depends on the vertical viscosity and the initial radius of analyticity in the horizontal variables.