Having a gun is only a small part of the total solution. SA, hand to hand fighting skills and the will to survive come first to mind.
The fact is that if you find yourself at a disadvantage in a SD situation you must use violence of action to seize and maintain the initiative. Everything is a weapon, used correctly. A basic ccw course does not prepare you for the reality of a violent encounter. As a part of every defensive tactics course you should get a shot of OC, there is no way to predict your response if you have never experienced the sensation.
If you carry or use a gun for SD you should be a master of that gun, meaning you run it without conscious thought. Statistics? They are less than worthless, I train to dominate and win any encounter I may find myself in, overboard? Maybe, but I am still here to annoy people.
regarding pistol versus knife it'd be good to look back at history. When the first repeating revolvers came on the scene they very quickly became the weapon of choice despite the fact that they don't even come close to being adequate by modern standards.
the techniques and the technology of bladed combat had been perfected by milleniums of experimentation and development and within a matter of a few decades knives and hand axes were relegated to a secondary place in the fighting mans arsenal.