There is quite a bit of inaccurate information in this thread. I come from a two-decade background in both LE Patrol and Tactical, and as an Instructor with credentials through my State's LEO governing body over Instructors. There are techniques for clearing structures with longguns, and training that I have been involved in results in suspects getting shot during gun grab attempts of those armed with AR15/M16/M4 platform weapons, as the LEO's are able to disengage the safety and shoot very efficiently. It is no different for non-LEO's. Holding a pistol at full extension to aim and shoot is the same overall length as if I am holding an M4 carbine and aiming and shooting.
Those who are advocating shotguns and buckshot, they can definitely be an effective tool, but are not without severe limitations or disadvantages. A 20-inch barreled 870 is the same overall length as a fullsize 20-inch barreled M16. A shotgun barrel of less than 18-inches requires a $200 NFA stamp, and by the time you get to a 14-inch barrel you are reduced to 4-5 rounds of capacity and increased recoil and blast, which magnifies inside a structure. Way too many people expect to stop a threat with a single shot of shotgun ammunition. I am aware of numerous OIS's, including one where a suspect absorbed a full 870 magazine of 12-ga OOB to his torso before exclaiming "OK, I'm done." MOre and more shootings and threat situations are involving multiple suspects. Think of that when you only have 4-5 rounds.
At least no one is throwing out the idiocy of "Just rack the shotgun and they'll run away skeer'd", or "I use birdshot fer home defense!" Shotshells from a handgun, which I did see mentioned, are absolutely ignorant of what it actually takes to stop or incapacitate a threat reliably. Just as ignorant was the statement back in 2011 of having to worry about houses within a mile if you use a 5.56 carbine with that little itty bitty bullet that sheds velocity. I know of two officers killed because of that type of ignorance. The fact is, the .223/5.56 cartridges penetrate LESS in dry wall and structures than common cartridges shot through pistols, and DEFINITELY less than rounds fired through shotguns. NUMEROUS governmental agencies has tested this and found it to be accurate. The safest and MOST EFFICIENT gun you can use for home defense if you're worried about over penetration is an M4-type carbine with 55 grain softpoints. Look at it this way. A Chevy Suburban is the pistol bullet travelling 55 mph gets into a crash. The vehicle remains pretty much intact, and the mass takes longer to lose the 55 mph velocity. Now take a crotch rocket representing a 5.56 travelling at a faster 100 mph gets into a crash. It's lightweight and sheds the velocity quickly, and the total package shreds apart quickly and easily, including the rider.
I'll take the lower recoil, increased ammunition capacity, higher accuracy, better ballistics, quality weaponlights for ID'ing my threat, and all in a compact package that anyone in my family, including pre-teen kids, and use if needed. It's not the shotgun, but a decent M4 carbine.