Planetary Defense Force
"To save our mother Earth from any alien attack
From vicious giant insects who have once again come back
We'll unleash all our forces, we won't cut them any slack
The EDF deploys!
Our soldiers are prepared for any alien threats
The navy launches ships, the air force send their jets
And nothing can withstand our fixed bayonets
The EDF deploys!
Our forces have now dwindled and we pull back to regroup
The enemy has multiplied and formed a massive group
We better beat these bugs before we're all turned to soup
The EDF deploys!"
- – Earth Defense Force 2025
In Warhammer 40,000, a Planetary Defense Force is, as the name suggest, an armed force that protects a single planet (as opposed to the Imperial Guard, which travels from planet to planet). They have a tendency to respond to any major local threat, then be killed to a man.
The Imperium of Man is a very feudal empire; while much is made of the Space Marines and Imperial Guard, they cannot be everywhere at once, and so each world is expected to be able to protect itself. On civilized worlds, the PDF fill that role, either fending off attack entirely, or holding out long enough for off-world assistance to arrive.
We never hear about their victories, partly because stories where the PDF wins are not as interesting as those where the Imperial Guard and Space Marines have to get called in, and partly because most planets make their Imperial Tithes by bundling the best few percent of their Planetary Defense Forces into IG Regiments and shipping them off-world. It is also important to remember that sitting on a safe backwater planet for centuries means that they have absolutely no combat experience compared to IG regiments that are shipped from one warzone to another. Add to that they have even less equipment, no comm-beads for individual soldiers, and that for an entire system of planets a single Commissar is attached. Ironically, planets with a feral orks infestation tend to have a better PDF and produce better IG regiments. However, the average PDF unit tend to fold like wet paper when a significant off world threat arrives. As such, the Imperial Guard consider them grossly undertrained, incompetent, and poorly armed compared to the Guard. The irony of this is lost on the Guard itself. Better yet, it highlights just how bad it is to be a member of the PDF.
Another major problem for the PDF is lack of experience and as a result, morale. PDF from a forgotten backwater planet do not typically see a lot of action and as a result lack any combat experience. Add to this that most information sources available to them are compatible to the IG uplifting primer (and they don't have anyone around to tell them what a pile of groxshit it is) and you can see why facing the untold terrors of cosmos might go south very quickly for them.
To be fair, not all PDF are incompetent pushovers. For example, Cadia's entire population is militarized from birth, in reserve if not in active duty, and those active duty Cadians who are selected to stay instead of being shipped out to the Guard are chosen at random instead of by lack of merit. This means that Cadia's PDF is every bit as skilled and tough as any of the planet's many exported Imperial Guard regiments, and train just as hard, just as frequently, and are just as well supplied for being on a fortress world. The shipped regiments are also rotated frequently enough meaning that most Cadian PDF actually have some combat experience. However, examples like this are the exception rather than the rule when it comes to PDF quality.
Often, when PDF aren't incompetent, they turn traitor. While an Imperial Guard unit is constantly shuffled from world to world, only resting in transit, and under the watchful eye of a Commissar, the PDF may go for years or even lifetimes without seeing a planet-scale defensive effort. As such, they often also serve as local law enforcement. This can result in the PDF being more loyal to the planetary government than to the Imperium; if the planetary government turns corrupt, they can bring the PDF with them, which makes it that much harder for the Imperium to reclaim the planet later. Also, even if they did not turn traitors they are the most suspected people if heretical cults are active on the planet, and they usually are, or the planet got infiltrated by Genestealers. Thus even if a problem arose the guards would still avoid them and the authorities would still distrust them to use them so that they might gain combat experience.
The three notable exceptions to this rule are the Armageddon PDF, who often fight the Orks still on the planet, as a result of a lower than normal Tithe for a planet of its size allowing the Armageddon PDF to be well trained and funded. The other is the Ultramar Auxilia, as Ultramar has no tithe due to supporting the Ultramarines Space Marine Chapter, also since they must meet the standards of Space Marines resulting in higher than normal training, generally they are still shipped offworld like normal guard and often support the Ultramarines. And the last is the Cadian Interior Guard whose members are chosen from one out of ten best men in the Cadian Shock Troops Imperial Guard regiments.
The greatest irony is that if the Imperium would only enforce the training of planetary defence forces to a decent standard (as they are so eager to get their mitts on your tithes!) then the heretic and xenos would have a damn harder time taking over worlds and the guard and marines won't have to keep running in to save them and could actually concentrate on the full scale invasions (But of course that much common sense won't be at all grimdark enough....). Not to mention the fact that if the Imperium were to require worlds to also have their own law enforcement that is controlled by, trained by, and generally indoctrinated by, the Adeptus Arbites, you wouldn't have to worry much about A) crime (pickpockets would be shot, soooo...yeah) or B) turncoat PDF (because of fanatical loyalty to Imperial law). So then you would technically have two competent fighting forces on the planet, both of which are separate enough from local affairs to remain loyal to the Imperium. The PDF and the local law enforcement. Then the Guard to concentrate hundreds, perhaps thousands of regiments on threats instead of a few dozen. Not to mention how much hurt the Astartes would be free to lay down. However, it's questionable whether such indoctrination would work. One of the reasons that the Arbites are so loyal to the Imperium instead of the planet they're stationed on is because they come from a different planet.
In general, in cases where PDF would get the opportunity to gain the experience and funding necessary to become a reliable fighting force, they don't tend to keep the title of PDF for long. However, the PDF do their jobs as well as they can with the equipment they have, and typically its only confirmation bias that they get such a bad rap (If deservedly so). Usually they are sufficient enough to keep the peace and fend off minor threats like a small savage Ork incursion or petty bandits.
PDFs also have a couple advantages over Guard. As stationary forces, they have a home field advantage. Planets in the Imperium run the gamut between "nice enough" and "kill you if you look at it funny" so being able to utilize a world's natural defenses and terrain is helpful. Secondly, PDFs can utilize stationary gun emplacements and shield generators (or even space stations defense). It is remarkably difficult to shoot through a world with anti-naval cannons and an exterminatus-resistant shield network. Generally PDF losses occur because the onus of victory is on the attacking force. That is, they only attack planets they can win against. Heavily-fortified fortress worlds can take centuries worth of orbital beating before they collapse. Take Vraks for example. While, yes it did go traitor, the fact that it took over 18 years to collapse shows just how long a well defended city (Remember Vraks only had one thing worth a damn about protecting on it. it was only ONE fortress) can last and what a toll it can inflict on it's attacker.
Also, there was one (yes, one) PDF trooper worth noting. Some family man with a forgettable name fought alongside Uriel Ventris of the Ultrasmurfs during a battle against Tyranids. When he ran out of shots for his lasgun, what did he do? He picked up a discarded chainsword and charged the 'nids with it! He actually managed to keep up with Ventris, an Ultramarines Captain. When a Carnifex came to blow them to bits with bio-plasma he ran back, grabbed a missile launcher, and shot it in the face! Then picked the chainsword back up and charged again. After the battle was over, Ventris visited him in the hospital and, in front of everyone announced that this man had saved his life and about how badass the guy was to keep pace with an Astartes. If you've played or seen the Space Marine game, you must realize how incredible a feat that is. Ventris then removed one of his purity seals and gave it to the man. Clearly, the mustering of the Guard missed one.
And the ones Ciaphas Cain hang out with in Death Or Glory.