When it comes to careers, the general consensus is that people take grueling and dissatisfying jobs in their 20s and 30s to “pay their dues” so they can get better gigs later in life. But job satisfaction earlier in your career shouldn’t be dismissed too quickly, according to researchers at Ohio State University, as it has been linked to overall health in your early 40s.

"You don't have to be near the end of your career to see the health impact of job satisfaction, particularly on your mental health," said Hui Zheng, associate professor of sociology at Ohio State University and co-author of the study, in a statement.

The team used data from 6,432 Americans who took part in the National Longitudinal Survey of Youth 1979—a survey following subjects between 14 and 22 years of age. Participants self-reported their job satisfaction from the ages of 25 to 39, and reported health conditions once they turned 40.

The researchers found a correlation: those who were less happy with their jobs early in their careers were more likely to show mental health problems later on in life. Specifically, subjects were more likely to be depressed, suffer from excessive worry and had more trouble sleeping. Those who were unhappy early in their careers but had their work satisfaction increase over time did not show similar signs of declining health.

"We found that there is a cumulative effect of job satisfaction on health that appears as early as your 40s," said Jonathan Dirlam, lead author of the study and a doctoral student in sociology at The Ohio State University, in a statement.

Proving cause and effect would require more research but the study's initial findings do suggest that job satisfaction is important for health. Since data on mental health was only taken when the subject was in their 40s, there is no way to see how job satisfaction impacts individuals further on in life.

"The higher levels of mental health problems for those with low job satisfaction may be a precursor to future physical problems," Zheng said. "Increased anxiety and depression could lead to cardiovascular or other health problems that won't show up until they are older."