(CNN)You know the story of Goldilocks and the three bears, right? Papa Bear's bed was too hard and Mama Bear's bed too soft, but Goldilocks found Baby Bear's bed to be "just right."
That fable could apply to sleep duration in people as they age as well. Just like Baby Bear, older people who sleep "just right" -- getting roughly six to eight hours of quality shut-eye most nights -- appear to delay cognitive decline and keep their brains sharp, according to a study published Wednesday in the journal Brain.
"Our study suggests that there is a middle range, or 'sweet spot,' for total sleep time where cognitive performance was stable over time," said study coauthor Dr. Brendan Lucey in a statement. Lucey is an associate professor of neurology and section head of the Washington University Sleep Medicine Center in St. Louis.
The study monitored the sleep of 100 older adults who were tested for cognitive decline and evidence of early Alzheimer's disease and found that only those who slept six to eight hours retained stable cognitive functioning.
If a person slept fewer than five and a half hours, their cognitive performance suffered, even after controlling for factors like age, sex and Alzheimer's pathology. That applied to people on the other end of the sleep spectrum as well. If they slept more than about seven and a half hours, cognition declined.
"Not only those with short amounts of sleep but also those with long amounts of sleep had more cognitive decline," said coauthor Dr. David Holtzman, scientific director of the Hope Center for Neurological Disorders at Washington University School of Medicine.
"It suggests that sleep quality may be key, as opposed to simply total sleep," he said in a statement.
Aim for continual, quality rest
Adults need to sleep at least seven hours a night, while school-age kids need nine to 12 hours and teens need eight to 10 hours, according to the US Centers for Disease Control and Prevention. Older adults often struggle to get a full seven hours due to chronic conditions and medications that might cause them to wake.
But getting good, restorative sleep is about more than a number. The quality of the sleep you get while your head is on the pillow is also critically important. If you wake frequently due to noises or sleep apnea or to use the bathroom, that's interrupting your sleep cycle -- and depriving the body of the restorative sleep it needs.
The "sweet spot" for sleep is when you can sleep continuously though the four stages of sleep four to six times each night. Since each cycle is roughly 90 minutes long, most people need seven to eight hours of relatively uninterrupted sleep to achieve this goal.
In stages one and two, the body starts to decrease its rhythms. Heartbeat and breathing slow, body temperature drops and eye movements stop. That prepares you for the next stage -- a deep, slow-wave sleep, also known as delta sleep. This is the time the brain repairs the body from the day's wear and tear. During deep sleep, your body is literally restoring itself on a cellular level.
Rapid eye movement sleep, called REM, comes next. This is the stage in which we dream and information and experiences are consolidated and stored in memory. Studies have shown that missing REM sleep may lead to memory deficit and poor cognitive outcomes, as well as heart and other chronic diseases and an early death.
A chronic lack of sleep, therefore, impacts your ability to pay attention, learn new things, be creative, solve problems and make decisions.