Hello:

Before I want to pay attention to some optimizer features, I want to
estimate how much benefits it can create for customers, at least for our
current
running customer. So I want to have some basic idea what kind of the query
is
running now in respect of optimizer.


My basic is we can track it with the below struct(every backend has one
global
variable to record it).

+typedef struct
+{
+       int     subplan_count;
+       int     subquery_count;
+       int join_count;
+       bool hasagg;
+       bool hasgroup;
+} QueryCharacters;

it will be reset at the beginning of standard_planner, and the values are
increased at  make_subplan, set_subquery_pathlist, make_one_rel,
create_grouping_paths. later it can be tracked and viewed in
pg_stat_statements.


What do you think about the requirement and the method I am thinking? Any
kind of feedback is welcome.


-- 
Best Regards
Andy Fan

Reply via email to