Some knee replacement patients now leave the hospital the next day, or even the same day.

(Bloomberg Business) — Americans are getting older, and heavier—and both trends are trouble for the country’s knees.

The rate of total knee replacements almost doubled between 2000 and 2010 for Americans over 45, according to new data from the Centers for Disease Control (CDC), while the average age of patients decreased by more than two years, to 66.2. The elective surgeries, which replace worn-out cartilage and bone with metal and plastic mechanical joints, became the most common inpatient hospital procedure for people over 45 in 2008. Almost 700,000 were performed in 2010.

The annual market for knee implants is roughly $4 billion in the U.S., according to estimates compiled by Bloomberg Intelligence analyst Jason McGorman. The cost of the surgery can vary wildly depending on the region or hospital. On average, it’s increased to about $16,600 in 2012, from $13,900 in 2000, in inflation-adjusted dollars, according to CDC data. Though there are risks with any surgery, including possible infections or implant failures, knee replacements are considered a highly cost-effective intervention, McGorman says, because they can allow people to continue to work and avoid disability or other expensive care.

See also: Saving Medicare, starting with the hips and knees

Two big demographic shifts help explain the knee replacement boom. First, people are living longer: Life expectancy for 65-year-olds increased by a year-and-a-half between 2000 and 2010. That, combined with growing numbers of overweight and obese Americans, is exacerbating osteoarthritis, the joint damage that knee implants are meant to relieve.

Here’s what happened to the obesity rate (for adults 20 and older) over a similar period:

People who have joint replacements before age 60 are more likely to be obese and to have other health problems like diabetes or heart and pulmonary conditions, says David Ayers, chair of orthopedics and physical rehabilitation at the University of Massachusetts Medical School. “It’s not that these are young, healthy, fit people,” says Ayers, who has analyzed data on 35,000 joint surgery patients in a federally funded database.

See also: Health care pricer: Bundle it

The force on the knee when going up stairs can be three to five times body weight, says David Teuscher, president of the American Academy of Orthopaedic Surgeons. Not everyone who suffers from obesity gets knee pain, but the extra weight can aggravate arthritic knees. The relationship may run both ways, as joint pain deters people from work or exercise. “We counsel our patients for weight reduction, but more and more we’re realizing that they’re never going to be able to lose the weight unless we replace the knee and put them into an exercise program,” Teuscher says.

Richard Rothman, founder of the Rothman Institute, a Philadelphia orthopedic center, says he once deterred younger patients from joint replacements if possible. Improvements in the implants and surgery have changed that calculation. In 1970, recovery typically meant three weeks in the hospital. Now, Rothman says, many patients are discharged the next day, or even the same day. Doctors have developed better methods of managing pain during and after the operation, and the artificial joint materials have become more durable, reducing the likelihood that younger patients will need to replace implants.

Some patients who get knee replacements don’t get the benefits—particularly if their pain or impairment was mild to begin with. “The actual eligibility criteria for [total knee replacement] is by definition vague,” says Daniel Riddle, a physical therapist and professor at Virginia Commonwealth University. He led an analysis of 205 knee replacements that judged almost one-third of them to be inappropriate. After two years, that group showed little improvement. The results, from four study sites, aren’t generalizable to the U.S.

Riddle says people with depression or conditions that make them more susceptible to pain may have a harder time recovering. Patients considering the procedure need to weigh the severity of their symptoms with their expectations for recovery. A new artificial knee won’t mean a sidelined tennis enthusiast will be able to return to the court. “If a patient’s expectations are so high that they’re unrealistic, those patients are going to be dissatisfied,” Riddle says.

Copyright 2018 Bloomberg. All rights reserved. This material may not be published, broadcast, rewritten, or redistributed.