![The Battle Plan](Postgres/assets/arch_chap_3_battle_plan.png) # Chapter 3: The Battle for Efficiency (Planning & Operations) When you hand an incredibly complex request to Postgres, the engine does not immediately grab a shovel and start digging. That would be rash, and rashness leads to unnecessary physical exertion. Instead, it hands your request up the chain of command to the **Query Planner**—the Lazy General. The General sits comfortably in his tent, far away from the physical labor of scanning pages or building hash tables. His sole responsibility is to calculate the absolute cheapest, fastest, most effortless path to achieve your goal. But he doesn't work alone. He has an army of specialized **Soldiers** (Operation Nodes) at his disposal, and he must choose which ones to send into battle. In this chapter, we will explore: 1. **Planning**: How the General calculates the "Cost" of laziness. 2. **Sargability**: How the way you ask a question determines if the General can use his best shortcuts. 3. **Operations**: The actual physical labor performed by the soldiers.