Opioids can be an effective painkiller following major surgery but prescribing them is not without risk.