If you want the full experience of a beach holiday, aim for 5 days on the entire island. That way you can explore a major city, maybe visit a medieval village or 2, and just enjoy relaxing on a few different beaches. But if you've included a stop in Sardinia on a larger tour of Mainland Italy, you can easily do a day or 2! Then, I recommend sticking to 1 major city. Explore the winding, narrow streets, take guided tours of the splendid churches, and eat good food for every meal.