We have long, long threads about bears and cougars and people attacking people. Fido attacks more people than any other critter out there, except ourselves (humans attacking humans, I mean).
I have a Brittany Spaniel (Epagnuel Breton). I bought her because that breed has been culled for over 100 years to eliminate dog and human aggression. There were other reasons, primarily bird hunting, but that was the final one. I love the GSP, but they get too human, dog, and fur aggressive to suit me. I love Dobermans and GSDs, too, but ... I had little kids when I was shopping for a dog, and neighbors and friends and siblings with little kids. Mine are in Jr High and HS now, but the little kids keep cropping up from the other peoples' houses, and they're always in my house.
My dog will run and hide in her crate before she'll hurt one of those kids. That's what I want. She'll bark at the door. That's as much as I want her to do. I'm 5'10". I weigh 200lbs, and I have guns. She doesn't need to defend me. She's 27lbs of bird dog that thinks she's a lap dog. She'll lick people to death. But if we're ever threatened by a dangerous dog, the last place she'll be is between me and that dog. She has, multiple times, done exactly what I want her to do in that situation - get behind me and let me swing my stick.
Were I still able to run, I would carry an Airweight Jframe S&W, and an ASP. Dogs don't like it when you swing sticks at them. If they're not convinced by the stick, either swinging or knocking them about, then it's time for the gun. In fact, that's what I usually carry when I walk my dog, except I use a walking stick instead of an ASP.
I very nearly got into a fight with a guy who thought I was threatening his pit one day when it came after me, my dog, and my wife. But when he came up to me, he realized two things - First, I was inches taller than him, lift weights, and had a big damn stick in my hand, and second, it wasn't actually his dog. Or at least, that's what he said when I spun around with that stick as he came up to me yelling about why was I hitting his dog.
My reply? "I haven't hit anything, yet."
So, yeah, people will get uptight about you threatening their dogs.
The absolute closest I have yet come to actually knocking a dog in the head was when a hound mix ambushed me and my Brit from between two parked cars. He was very serious. I had seen him stalking another dog walker from down the street - he bit that dog, I found out later. I crossed the street to be away from him, but he just picked another ambush site. My Brit danced around behind me when he came out, but he took off when the end of my stick swished past his nose.
The only time I've ever shot at a canine that was threatening me or the Brit was a coyote. We were hunting quail, and she was hitting some cover about 70 yards away when a coyote jumped up from where he was sunning himself and started stalking her. I popped off a round from my pistol that kicked up dirt in his face, and he left PDQ.
Dogs are no joke, for sure. Neither are their owners. But I'm not getting bitten again, even if I have to have it out with the owner after. Got bit a couple of times when I was delivering papers on my bike as a kid. Knocked one in the head with my big shackle lock, after it chased me and knocked me down. Not getting bitten again.
Any gun, .22lr and up, will kill a dog. My aunt used a .22 rifle to pop a GSD that was chasing a week-old foal in her corral. It ran off, but didn't make it to the road before it pitched over in the ditch next to the driveway. My dad was an animal control officer in the 60s. He used a .22 revolver, and a .22 rifle to take care of problem animals. Dogs aren't any tougher today - unless, perhaps, you think you need to be ready for one of those freakishly huge mastiffs. .22 will do the job, if you will do yours (hit the target).
Carry something you shoot well, and have a plan to deal with what may come up.
The plan, and your skill in implementing it, is more important than what gun/caliber you have. That's true for many situations.