Your first job can be a grind. Many of us start out in gigs that we never thought we’d have to take, maybe because the job market is just too tough and we need to make ends meet so we can move out of our parents’ basement. For those of us who are lucky, the situation is temporary and a steppingstone to something we love, but for others it can be the start of many years of a career that we hate.

At least you have your health, right? Actually, it looks like the consequences of your unhappiness with your work may affect your physical and mental well-being — and perhaps sooner than you might think.

An analysis by Ohio State University’s Jonathan Dirlam and Hui Zheng, presented this week at the American Sociological Association’s annual meeting, shows that job satisfaction in your late 20s and 30s appears to be linked to your health in your 40s.

The researchers’ data comes from 6,432 Americans who participated in the National Longitudinal Survey of Youth in 1979. Through the years, the volunteers ranked how much they enjoyed their jobs on a spectrum from 1 — dislike very much — to 4 — like very much. They also reported back on various health indicators.

Dirlam and Zheng found a striking link between people who were less satisfied with their jobs in their 20s and 30s and those who had health issues in their 40s. That may seem intuitive, given that people tend to spend eight or more hours a day at work and dissatisfaction at work can create a lot of stress. As has been well documented, stress can have physical manifestations.

Among the specific health effects that the researchers noted among the less-than-happy group is that they had trouble sleeping and were more depressed and worried.

One interesting aspect of the analysis is that the health effect was not related to your happiness with your very first job or jobs but with how your happiness with your job changed over time. Those with increasing satisfaction fared better than those with declining satisfaction in terms of their health.

Dirlam, a doctoral student in sociology, explained that there appears to be a “cumulative effect of job satisfaction on health that appears as early as your 40s.”

Read more:

Like our Health & Wellness page on Facebook for more science news about the ins and outs of the human body and mind, essays and advice. You can sign up here for our newsletter.