It is one of the ironies of capital punishment that it has to be meted out to be effective, but not too much, and where the "golden mean" stands is difficult to define. The death penalty means nothing in the US because very few of those sentenced actually are executed, and even then after decades of appeals, so they live in general as long as the rest of us. Conversely, the death penalty meant nothing in fin-de-siècle China, because so many criminals were beheaded that they began to think of it as just one of the costs of doing business, so it didn't deter them from their crimes.
Also, few criminals ever think they’ll be caught and executed, whether the death penalty is applied rarely or freely.
“I’m too smart. They’ll never catch me, just those other guys.”
Deterrence should never be the objective of punishment. It is retribution. If we enjoy a deterrant effect it is by the grace of God not the brilliant wisdom of the exorbitant, so-called rehabilitationists.