Find query characters in respect of optimizer for develop purpose

From: Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Find query characters in respect of optimizer for develop purpose
Date: 2020-05-18 08:29:44
Message-ID: CAKU4AWr83NNdjj8hzD4fmJdP5HTxYXFkRt_KbgE0dkojzTJVNw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2020-05-18 08:44:43 Re: Fix a typo in slot.c
Previous Message Greg Nancarrow 2020-05-18 07:33:10 Re: Libpq support to connect to standby server as priority