Regularly getting a good night's rest is incredibly important. While you’re sleeping, your body is sorting memories, cleaning out your brain, boosting your immune system, and otherwise recovering from the day. But there is such a thing as too much of a good thing: According to Popular Science, it's possible to sleep too much.

It's hard to say exactly how much sleep you should be getting each night, but a new observational study of more than 116,000 people across 21 countries finds that sleeping nine or more hours a night is correlated with a higher mortality risk. The sweet spot for healthy sleep habits, according to this data, seems to be six to eight hours each night. (Even if part of that time comes from daytime naps.)

The new paper published in the European Heart Journal examined data from the Prospective Urban Rural Epidemiology study, followed individuals between the ages of 35 and 70 across the world, some of whom lived in high-income countries like Canada and Sweden; others of whom lived in countries considered middle-income, like Argentina and Turkey; and others who lived in countries considered to be low-income like Bangladesh and Pakistan.

Over the course of an average 7.8 years, study participants answered follow-up questions about what time they went to bed and got up, and whether they napped and for how long. They also answered general health questions about things like exercise rates, dietary patterns, and weight. The researchers then collected medical records and death certificates to track whether the subjects had major cardiac events (like heart attacks) or died during the study period.

The researchers found both sleeping too much and sleeping too little to be associated with a higher likelihood of dying before the study was through. Across the world, participants who got less than six hours a day or more than eight hours a day were more likely to experience major cardiac events than participants who slept between six and eight hours a night. When the researchers adjusted the results for age and sex, they still found sleep duration to be a significant predictor of heart issues and all-cause mortality.

While adjusting for factors like physical activity, BMI, and diet did change the results a bit, the basic pattern—a J-shaped curve showing higher risk for short sleepers, low risk for moderate sleepers, and even higher risk for very long sleepers—was the same. While previous research has suggested that naps can be good for your health, this study found that napping was associated with worse outcomes if it put someone over the eight-hours-of-sleep mark in that 24-hour period.

The results may feel like vindication to people who feel terrible whenever they stay in bed too long, but there are some caveats. Sleeping nine hours a day might be a sign that someone has an underlying health condition that in itself poses a higher mortality risk, rather than the cause of the higher mortality risk in itself. The researchers tried to account for this by analyzing the data only for people who were known to have no prevalent diseases and who weren't at risk for conditions like sleep apnea and insomnia, and later by excluding people who had a cardiac event or died during the first two years of the study.

"This suggests that sleep duration per se may be associated with increased risks," they write (emphasis in the original), "but causality cannot be definitively proven from this or other observational studies (and randomized studies of different sleep durations may be difficult to conduct)." So we may never know for sure just how much risk we take upon ourselves when we settle in for a long nap.

Considering that plenty of other research suggests that around seven hours of sleep total is an ideal target, you should probably aim for that number while setting your alarm. And if getting too much shut-eye isn't your problem, check out our tips for getting back to sleep after you've woken up in the middle of the night.

[h/t Popular Science]