Re: Planning counters in pg_stat_statements (using pgss_store)

From: Julien Rouhaud <rjuju123(at)gmail(dot)com>
To: legrand legrand <legrand_legrand(at)hotmail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Planning counters in pg_stat_statements (using pgss_store)
Date: 2019-03-24 12:10:59
Message-ID: CAOBaU_bhG+=5bqMoUEcKF+Yaqk8fqfr5FCwfKS07_tyOUbk9qg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Mar 24, 2019 at 11:24 AM Julien Rouhaud <rjuju123(at)gmail(dot)com> wrote:
> > > there are 4 tests to check if planning_time is zero or not, it's quite
> > > messy. Could you refactor the code to avoid so many tests? It would
> > > probably be useful to add some asserts to check that we don't provide
> > > both planning_time == 0 and execution related values. The function's
> > > comment would also need to be adapted to mention the new rationale
> > > with planning_time.
> >
> > Fixed
>
> + /* updating counters for execute OR planning */
> + Assert(planning_time > 0 && total_time > 0);
> + if (planning_time == 0)
>
> This is obviously incorrect. The general sanity check for exclusion
> between planning_time and total_time should be at the beginning of
> pgss_store. Maybe some others asserts are needed to verify that
> planning_time cannot be provided along jstate or other conditions.

Actually, since pgss_store is now called to either:

- explicitly store a query text
- accumulate planning duration
- accumulate execution duration

and they're all mutually exclusive, It's probably better to change
pgss_store to pass an enum to describe what the call is for , and keep
a single time parameter. It should make the code simpler.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2019-03-24 12:16:44 Re: current_logfiles not following group access and instead follows log_file_mode permissions
Previous Message Haribabu Kommi 2019-03-24 11:30:47 Re: pg_basebackup ignores the existing data directory permissions