The death penalty is not a deterrent because, contrary to popular opinion, it is rarely used.
It sometimes takes decades for a criminal to make it all the way through the trial, and appeals, second trial, more appeals, pleas for clemency from civil rights groups, and more appeals and thus, finally, to the day of execution.
Despite the publicity given to the executions in Texas, criminals know that their chances of actually being executed are extremely low. So they are NOT deterred from committing acts of murder, rape, etc.
If DNA evidence points to the person accused of the crime, judgement, and punishment, should be swift and final. The certainty of punishment would be the best deterrent of all.
Shuckins