How effective is exercise in preventing heart attacks?

How effective is exercise in preventing heart attacks?