Get the App
SLTechnology News&Howtos  ›  Database  › 

PostgreSQL Source Code interpretation (37)-query statement # 22 (query Optimization-grouping_plan...

Shulou Source: shulou.com Published: 2022-06-01 04:46:12 10月01日 Update

After the main function subquery_planner completes the outer join elimination, the grouping_planner function is then called, and this section briefly introduces the body logic of this function.

I. Source code interpretation

Grouping_planner function source code:

/ *-* grouping_planner * Perform planning steps related to grouping, aggregation, etc. * * generate the "planning steps" * * This function adds all required top-level processing to the scan/join * Path (s) produced by query_planner related to grouping / aggregation. * * this function also handles all scan / connection paths that need to be processed at the top level (generated by the query_planner function) * * If inheritance_update is true, we're being called from inheritance_planner * and should not include a ModifyTable step in the resulting Path (s). * (inheritance_planner will create a single ModifyTable node covering all the * target tables.) * * if the flag inheritance_update is true, the caller of this function is inheritance_planner, and the ModifyTable step should not be included in the result path (inheritance_planner creates a separate ModifyTable node that covers all target tables). * * tuple_fraction is the fraction of tuples we expect will be retrieved. * tuple_fraction is interpreted as follows: * 0: expect all tuples to be retrieved (normal case) * 0

< tuple_fraction < 1: expect the given fraction of tuples available * from the plan to be retrieved * tuple_fraction >

Tags: Functions statements paths processing grouping query sorting generation source code information cost quantity steps proportions results projection statistics planning preprocessing general Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Apple MySQL Redmi Shulou Technology