Personally, I tend not to defend anything other than the home system in the early phase of the game, and even once I get a strong enough economy to afford to defend other locations I tend to concentrate on defending colonized systems; as bingling suggested, having a force capable of going after the pirate spaceports is a more sure and less expensive way of dealing with pirate problems than building up defensive squadrons, stations, and garrisons all over the place. Still, if you want to defend a system, three to five size ~200-300 ships are usually an adequate force to run raiders off from a colony and protect freighter traffic or station construction in the system (my preference is to use blaster-armed ships and give each ship in the defense squadron a boarding pod; sometimes you'll get lucky and capture a pirate ship), and a garrison of perhaps five infantry units is usually adequate to deal with raiding forces which land on the colony. Five Human or better (12100+ strength) infantry units are also what I consider to be the minimum force necessary to go after a Hidden Pirate Base; ten Human or better infantry units are what I'd consider an adequate force to go after a Hidden Pirate Fortress. If using worse infantry, I'd suggest using ten units to go after Hidden Bases and fifteen to go after Hidden Fortresses. I will add that it is a very good idea to have a fuel source somewhere close to the region in which you expect a squadron of ships to be operating for any significant length of time, preferably in the same system as the squadron is stationed.
It's very unlikely that a new colony is worth giving a full garrison or a defensive squadron immediately, so I would suggest locally recruiting the garrison (you don't pay upkeep on a ground unit until recruitment is completed) and not worrying about posting a squadron to the system unless pirate attacks on freighters and passenger ships going to the system become a significant problem. Of course, if you have the economy to support a defensive squadron or can spare a more significant force for a while, it won't hurt to post ships there at least for a little while. I would also suggest that a defensive squadron is more useful than the garrison for shutting down pirate activity, if you feel you have to choose one or the other, as the ships can kill the pirate ships which launch raiders and protect other things in the system whereas the garrison can only fend raiding forces off, and you can use the army you use to invade independent colonies to eradicate pirate bases from your own worlds if necessary.
Colonies can additionally become completely immune to pirate raids if you complete a Planetary Shield Generator on the colony (requires Massive Shield Projection in the Energy and Construction tree, which is the tech after the final upgrade to Corvidian Shields), though note that Planetary Shield Generators do not protect anything except the colony itself, have a relatively significant up-front cost (20,000 credits, which is probably enough to buy about 5 size ~300 early-game warships or pay the maintenance on five infantry units and a defensive squadron for two in-game years), and can be destroyed by raiders while under construction. Planetary Shield Generators will also not prevent the passive pirate influence generation from the presence of pirate ships over the colony, so even with one on the colony you may still require ground forces to prevent Hidden Bases or Fortresses from going up.
Escorts or frigates will often escort a private sector ship if automated, or you can order them to do it. The problem is that there will be many more private sector ships than escorts. The good news is that the private sector ships will automatically try to run away from danger and will often succeed.
I am of the opinion that issuing escort orders, or allowing the computer to do so, is a waste of time and resources, though if you're playing with unfleeted automated warships it's an unavoidable inefficiency. It's extremely difficult to successfully intercept a ship which is at hyperspeed and I don't believe that the computer will really even attempt to do so (its ships might take potshots at a passing vessel and will sometimes pursue things which attempt to escape into hyperspace, but I've never seen it camp ships out on a hyperlane to attempt to intercept passing vessels or anything like that), which means that the time that an escorting warship spends accompanying a ship at hyperspeed is mostly wasted, and if the civilian ship's destination already has defenses it's unlikely that there will be a significant difference in how quickly warships will be able to respond to an attack on the civilian ship whether the civilian ship is accompanied by an escort or not.
If you're thinking about using warships to escort private sector shipping, I would suggest that a better use of those ships would be to secure the system(s) in which the private sector shipping will be stopping with defensive squadrons, focusing on securing the systems which see the highest volume of traffic first (the systems which most consistently see the highest volume of traffic are usually the home system and those systems which host active shipyards, major colonies, and fuel mines).
A lot of defenses to keep something really valuable, must be able to stop an AI fleet. To stop them from destroying a mine is probably impossible. To defend a very rich colony, I would drop a large spaceport, 4 defensive bases, and a fleet stronger than what the AI brings on top of it. With the added ground force large enough to stop a troop transport or two slipping through.
I'm more in favor of providing high-value systems with enough defenses to stall a significant attack long enough for a counter-attack force to arrive, myself. System defenses strong enough to repulse a significant attack without outside assistance are just too expensive for any system you can survive losing, and there's very rarely any single system, aside from the home system (and even the home system can cease to be that valuable later in the game), which is that valuable to me.
< Message edited by Aeson -- 4/27/2017 4:52:14 PM >