Inside the five-stage pipeline from 1.1.1, there is another fork right after the parser. PostgreSQL classifies every SQL command into one of two camps. One side holds the optimizable queries, the other holds the utility commands. The classification is decided by a single field on the Query node, commandType , and from that point on the two camps travel completely different paths . One goes through the rewriter, the planner, and the executor. The other bypasses all three. This fork was a single line in the 1.1.1 picture, but it shapes the entire internal structure of PostgreSQL, so it earns its own section. Five optimizables, and everything else PostgreSQL defines its command types as a single enum. typedef enum CmdType { CMD_UNKNOWN , CMD_SELECT , CMD_UPDATE , CMD_INSERT , CMD_DELETE , CMD_MERGE , CMD_UTILITY , CMD_NOTHING , } CmdType ; Enter fullscreen mode Exit fullscreen mode Of these, CMD_SELECT , CMD_INSERT , CMD_UPDATE , CMD_DELETE , and CMD_MERGE are the optimizable ones.…