Have you or a loved one ever fallen into that deep, dark pit of despondency that is major depression? Then you know how debilitating this disorder can be. It’s small consolation to know that you’re not alone, given that depression affects 10% of men and 15% of women at some point in their lives.

Despite how common the problem is, treatment leaves a lot to be desired. Antidepressant medications help some, but not all, sufferers…and the drugs’ side effects (weight gain, sleep disturbances, loss of libido, even an increased risk for suicide) often are intolerable. Psychotherapy can be helpful…but it is time-consuming, expensive and doesn’t work for everyone.

A safe, effective, economical option: Exercise. Numerous studies have demonstrated the depression-relieving benefits of regular exercise, whether done as the sole treatment or in combination with medication and/or psychotherapy…and in some studies, exercise has even outperformed other treatment options for relieving depression. Recently, the American Psychiatric Association revised its treatment guidelines for major depressive disorder to include exercise.

However, no study had provided a clear sense of what really works best when it comes to depression-relieving workouts—until now. Researchers from the University of Texas Southwestern Medical Center have analyzed the available data from numerous earlier studies, looking at the varying effects of many different types of exercise…done at different intensities…and for different durations. Based on their conclusions, here are their recommendations on…

Aerobics vs. strength training. The majority of studies focused on the antidepressant powers of aerobic activities (walking, running, cycling, etc.), so the researchers know that aerobic exercise works. Still, there have been a few studies showing that strength training also alleviates depression…and one study that compared the two types of exercise showed no difference in their effectiveness against depression. Upshot: You can benefit from doing either or both types of workout.

Frequency. Not a lot of research compared the frequency of exercise, but studies that included three days of exercise per week showed the same benefit as studies that included five days of exercise per week. Recommendation: It’s best to work out at least three times each week, but there’s no need to hit the gym every single day to reap the mood-elevating benefits.

Session duration. Different studies in the analysis examined different lengths of exercise sessions, but for most of the studies, session duration ranged from 30 to 60 minutes. Best: In a large meta-analysis, 45 to 59 minutes per session was found to be the most effective.

Exercise intensity. Most studies did not look at the intensity of aerobic exercise, but the few that did showed a benefit for exercise that’s between 50% and 85% of the individual’s maximum heart rate. Maximum heart rate is roughly 220 minus your age—however, medications and health conditions can affect this number, so speak to your doctor about the most appropriate exercise intensity for you.

Though only two studies on the effect of strength training were done, both used the same level of intensity—three sets of eight repetitions at 80% of the person’s one-repetition maximum (1-RM). Your 1-RM for any given weight-lifting move is the maximum amount that you can lift just one time. For instance, if you can lift a 10-pound weight just once, then the intensity of strength training for you would be three sets of eight repetitions lifting an eight-pound weight. As you develop strength, your 1-RM will increase.

Length of the program. Exercisers often report feeling happier immediately after a workout—but that so-called “runner’s high” is just temporary. Sustained improvement in mood occurred after as little as four weeks of regular exercise, some studies showed…but to achieve the greatest antidepressant effect, an exercise program should be continued for at least 10 to 12 weeks, the researchers reported.

Adherence. One objection that has been raised about exercise as a depression therapy is that depressed patients may not be able to summon the energy or motivation to exercise. In this new analysis, however, researchers found that the dropout rate among exercise study participants was only about 15%—which is about the same rate at which depressed patients quit using antidepressant drugs or psychotherapy.

Bottom line: If you have been diagnosed with depression, or even if you suspect you might be depressed, there is no reason not to try regular exercise (provided your doctor gives you the go-ahead) before resorting to medication. If you are already taking an antidepressant, getting regular exercise may improve your mood further…and/or eventually allow you, under your doctor’s supervision, to taper off the drugs. Helpful: Some studies of the general population (not just depressed people) demonstrate that exercise programs that provide individual feedback and incorporate goal-setting strategies are more successful at keeping people enrolled, So consider working with a trainer who can offer feedback and help you establish goals…try a smartphone app that tracks your progress (click here for an article on that topic from The New York Times)…or simply use a pedometer to count your footsteps and provide a motivational boost.