This is called recidivism reduction. It guarantees that a dog cannot reoffend by killing it, this is quite different from deterring the dog from attacking in the first place
That sounds like revenge.
It does nothing to reduce the frequency of dogs attacking in the greater neighborhood, you just removed one. Dogs will still get rowdy, they could not care less that dogs before them attacked only be put down.
Revenge has no place in real life, it assuredly brings more death everytime. The death penalty is revenge, certainly not a deterrent.
You would have every single convicted murderer put to death?