Research has demonstrated that urban green spaces play a crucial role in mitigating the severe urban heat island (UHI) effect. However, existing studies often suffer from limitations such as the neglect of the cooling effect of water bodies within the green spaces and incomplete considerations of the overall cooling effect. These limitations may lead to inaccuracies in the research findings. Therefore, the present study takes the city of Xi’an as a case study to explore the optimal green space size for achieving efficient cooling. The results indicate that (i) urban green spaces exhibit robust cooling effects, with variations observed among the various types; (ii) for community parks without water, and for street gardens, the optimal areas of these green spaces are 3.44 and 0.83 hectares, respectively; (iii) for community parks with water, the area of internal water bodies should ideally be maintained at around 29.43% of the total green space area in order to achieve an optimal cooling efficiency. In conclusion, this study introduces a new perspective and new optimization methods for urban green space planning, thereby offering scientific guidance to urban planners in formulating effective development and management policies and urban planning schemes.