(CNN) Think you'll be around for a long time because Grandma lived to a ripe old age? Not so fast: Genetics has only a small impact on longevity, a new study involving more than 400 million people suggests. Longevity is mostly decided by lifestyle, with less than 10% down to DNA, according to the study , published Tuesday in the journal Genetics.

"We know that people who research their families are very interested in the topic of longevity," said Cathy Ball, a co-author of the study and chief scientific officer at Ancestry, a consumer genetics company that provides an online family history resource.

How much do our genes contribute to our life span?

Genetic differences explain just 15% to 30% of longevity, previous studies suggest, and it's the non-genetic differences between us -- such as how we eat and whether we have a fatal accident -- that explain why one person had a longer life than another.

Scientists from Calico Life Sciences LLC , a Google-funded company focused on the biology of aging, teamed up with researchers from Ancestry to investigate the genetic influence on life span. They analyzed anonymous family tree structures -- or "pedigrees" -- that included year of birth, year of death, place of birth and family connections for 439,361,203 people. These public family trees or pedigrees had been generated by subscribers of Ancestry.

The large size and scope of the database allowed the Calico scientists "to look across families over generations, analyzing longevity not just in family members, but importantly among in-laws as well," Ball wrote in an email.

With mathematical and statistical calculations, the team found that for siblings and first cousins, longevity heritability -- or how much of the variation in people's life spans can be attributed to genetic variations -- was about the same as previous studies indicated. Specifically, genes explained between 20% and 30% of longevity, with this estimate dropping below 15% for family relations of the opposite gender.

The researchers also found the life span of spouses to be similar -- more so than siblings of opposite gender. A possible explanation: Spouses live in the same household and therefore share important non-genetic factors, such as diet and general lifestyle.

Yet the study results also showed that siblings-in-law and first-cousins-in-law had similar life spans despite not being blood relatives and not sharing a living space.

What would account for this finding? The authors believe a likely explanation is "assortative mating."

"Assortative mating is a mating pattern in which individuals with similar phenotypes mate with one another more frequently than would be expected under a random mating pattern," J. Graham Ruby , lead author of the study and a scientist and principal investigator at Calico, wrote in an email.

Obviously, no one knows when they or a potential partner will die, so in this case, assortative mating would be based on secondary traits. For example, income is known to influence life span, as eating well and taking care of your health are both somewhat tied to money. If people from families of equal income tend to marry one another, this would explain similar longevity across non-family relations, the study suggests.

Factoring mating choice into their calculations, the researchers estimated that heritability actually explains no more than 7% of longevity, possibly even less.

Your genes alone cannot save you from an early death.

Genetic contributions to longevity

The new research adds to the existing "clues about what drives aging," said David Melzer, a professor of epidemiology and public health at the University of Exeter Medical School in the UK and a professor in the Center on Aging at the University of Connecticut Health Center in the US.

Melzer, who was not involved in the study, wrote in an email that "it would have been nice to see" the estimates for heritability in cases of exceptional longevity, because centenarians are believed to have a higher degree of heritability for longevity than others.

Melzer and Luke C. Pilling, a research fellow in genomic epidemiology at the University of Exeter Medical School, have also studied the genetics underlying longevity.

Get CNN Health's weekly newsletter Sign up here to get The Results Are In with Dr. Sanjay Gupta every Tuesday from the CNN Health team.

"Our own recent estimate of heritability of parental longevity directly from the common gene variants present in 75,000 people from Britain was 8.47%," which implies an individual's "total heritability of lifespan" at between 10% and 20%, Melzer explained. This is "significantly higher" than the 7% or lower suggested by the new family tree study, he said.

He noted that more than 20 genes have been identified for longevity.

"These include genes that interact with health behaviors, such as the nicotine receptor gene," Melzer said. He and his colleagues also found genes that influence cell senescence or the deterioration of individual cells. "It is likely that there are many such gene variants involved in lifespan and aging," he said.

Ultimately, Ball said, "although there is a genetic component, this study shows that there is a major impact from many other forces in your life."

The results suggest that anyone wishing for a long life would do better to eat right and exercise, rather than rely on Grandpa's good genes.