I'm sure there are statistics but don't know where they might be found. However, it's important to realize that, while some generalizations can be made, a variety of factors can influence retention. Some of those that have come into play in the 25 yrs

eek

since I was a mid . . .
War
Length of deployments
Planned drawdowns (and incentives to leave early)
Incentive pay to stay in
Civilian job market
Opportunities for command and/or flag rank
More working spouses (and issues with co-location)
View of military service
So, the numbers for today in terms of who stays for 20 and 30 years may have absolutely nothing with the situation for current USNA classes come 2-3 decades from now.
Also, it's important to understand that the ability to stay for 20 or 30 years is only partly yours. You must successfully promote to certain ranks to stay 20and 30 years, respectively. Also the rules for being able to "retire early" (i.e., with fewer than 20 yrs but with limited benefits) also change over time.