For this study, researchers wanted to assess the cognitive benefits of working out as they relate to aging and sleep habits and namely, how much sleep a person gets. To do so, they used data collected over 10 years from the English Longitudinal Study of Aging (ELSA), looking at factors like sleep duration, amount of physical activity, and cognitive function tests.

And as it turns out, based on their findings, there is a significant link between cognitive decline and working out on inadequate sleep.

For instance, study participants who were relatively more active but regularly slept less than six hours a night had faster cognitive decline over the course of the study. By the end of the 10 years, in fact, their cognitive function was no better than the participants who were less active.

On the flip side, the participants who were more physically active and getting six to eight hours of sleep a night had better cognitive functioning overall.

As lead author of the study Mikaela Bloomberg, Ph.D., explains in a news release, “Our study suggests that getting sufficient sleep may be required for us to get the full cognitive benefits of physical activity. It shows how important it is to consider sleep and physical activity together when thinking about cognitive health.”