Skip site navigation (1) Skip section navigation (2)

Re: auto_explain contrib moudle

From: ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: auto_explain contrib moudle
Date: 2008-11-18 03:14:36
Message-ID: 20081118114842.ED3F.52131E4D@oss.ntt.co.jp (view raw or flat)
Thread:
Lists: pgsql-hackers
Here is an update version of contrib/auto_explain patch.

Now it uses new ExecutorStart_hook and ExecutorEnd_hook.
When we execute queries using cursor, FETCHes are accumulated
and reported only once on CLOSE.

A new argument 'flags' is added in DefineCustomXXXVariable()
and custom GUC variables are defined with it. Some GUC_* constants
are moved to guc.h from guc_tables.h.

A variable "Instrumentation *totaltime" is added in QueryDesc.
It is not used by the core in default (always NULL), but initialized
by contrib modules. However, the core update the counter if it is
not NULL because multiple contrib modules might use it.
If the core don't update the counter, only one of the modules
should update it, but it's hard to determine which one should do.


Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> >> This would likely require adding a struct Instrumentation * field to
> Well, it's more general.  You could think of ExecutorRun as being like a
> plan node, in which case all the fields of struct Instrumentation are
> potentially useful.  If a contrib module doesn't want to use them,
> of course it doesn't have to.

Instrumentation is enough for auto_explain, so I used it for now.
However, pg_stat_statements also use the field and requires other
counters (buffer usages and rusage). It might replace the field
with another struct. Then we might need to reconsider how to deal
with session statistics, suggested by Vladimir.

"Vladimir Sitnikov" <sitnikov(dot)vladimir(at)gmail(dot)com> wrote:
> I wish PostgreSQL had some kind of pg_session_statistics view that reports
> resource usage statistics for each session.
> For instance, it could expose "buffer usage" to the client, so it could get
> more details on resource usage. For instance, I would like to see a new tab
> in pgAdmin that shows "total number of buffer gets", "number of WAL records
> created", "number of rows sorted" and similar information after query
> finishes (even in plain "execute" mode).

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center


Attachment: auto_explain.1118.tar.gz
Description: application/octet-stream (7.2 KB)

In response to

Responses

pgsql-hackers by date

Next:From: Bruce MomjianDate: 2008-11-18 03:22:29
Subject: Re: [GENERAL] db_user_namespace, md5 and changing passwords
Previous:From: Fujii MasaoDate: 2008-11-18 03:08:26
Subject: Re: Synchronous replication patch v2

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group