Menu

Post image 1
Post image 2
1 / 2
0

1.4 Planner: Which Path to Take

DEV Community: postgres·JoongHyuk Shin·3 days ago
#IlSfnqLl
#dev#tree#cost#planner#plan#index
Reading 0:00
15s threshold

By the time 1.3 ends, the rewriter has let the Query tree through. Views have been expanded, RLS policies have been wedged into WHERE clauses, and missing INSERT columns have been filled with defaults. The starting point of this chapter is one fact: that Query tree now has "what to do" fully decided, but "how to do it" not even by a single character. The stage that fills in that gap is the planner. The planner's input and output are clear. It takes one Query tree and produces one PlannedStmt. What it takes in is a tree of meaning; what it puts out is a PlannedStmt wrapping a tree of execution. The execution tree is built out of Plan nodes, and PlannedStmt bundles that tree together with the side information execution needs (for each referenced table, what lock mode to take; for each parameter slot the executor will fill at runtime, what type it is; and so on).…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More