Getting a graduate degree isn't always the best path to riches. With today's grads leaving school with an ever-increasing amount of debt, some four-year degrees offer a much better return on investment, a recent study found.

Those with a four-year undergrad degree in advertising and marketing, for example, get the biggest bang for the buck, according to a study by Bankrate.com. Grads in this field pay off their student debt in an average of six years (with 10% of their salary going toward repaying student loans) and earn a median income of more than $107,950 post-graduation.

Meanwhile, marriage and family therapists, who require an average of six years of schooling, rack up close to $65,000 in school-related debt and take close to 35 years to repay their loans. Even worse: They earn a median wage of just $46,670 a year, Bankrate found.

Rounding out the top five worst performing occupations were librarians, teachers, veterinarians, and reporters.

Related: How much will that college really cost?

Bankrate ranked degrees by the amount of schooling required, debt graduates accumulate, earnings post-graduation and years it takes to pay off student loans. Other degrees that offer a great return on investment included economists, civil engineers, political scientists and pharmacists.

Of course, other factors can impact how much a person earns, as well.

"Where you live, your cost of living and how much experience you have plays a great role in how much you earn right out of college," said Jessica Patel, a Bankrate.com analyst who worked on the report. "Your starting pay in Kansas City may be vastly different than your starting pay in New York City."

Related: Colleges with the best return on investment

But before you drop your library science major and head to pharmacy school, it's worth noting that the number of jobs available for any one occupation was not factored into the report. Some of the best performing jobs may be some of the hardest to come by. There may be fewer job openings for pharmacists than for teachers, for example.

"Students should also think about the likelihood of getting a job in a profession they desire when making decisions for their future," says Patel.