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

Re: [PATCHES] WIP: executor_hook for pg_stat_statements

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: Simon Riggs <simon(at)2ndquadrant(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCHES] WIP: executor_hook for pg_stat_statements
Date: 2008-07-16 02:49:13
Message-ID: 20080716104154.7860.52131E4D@oss.ntt.co.jp (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> >> That raises the question of whether we should have ExecutorStart() and
> >> ExecutorEnd() hooks as well, to round things off.
> > Yeah, and also ExecutorRewind() hook.
> 
> I'm happy to put in hooks that there's a demonstrated need for,

Hmm, ok. I just want to hook ExecutorRun, so I'll just propose to
add ExecutorRun_hook now.

The attached patch is the proposal. It adds two global symbols:
  * ExecutorRun_hook - replacing behavior of ExecutorRun()
  * standard_ExecutorRun() - default behavior of ExecutorRun()

And also modifies one funtion:
  * ExecuteQuery() - It passes prepared query's text to portal so that
        the prepared query's text is available at the executor level.
        This change is almost free because it copys only string pointer,
        not the string buffer.


The attached archive pg_stat_statements.tar.gz is a demonstration of
ExecutorRun_hook. It collect per-statement statistics of number of planned
and executed, plan cost, execution time, and buffer gets/reads/writes.
I'll happy if the addin will be accepted as contrib module, but if it is
not suitable, I'm willing to move it to pgFoundry.

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


Attachment: pg_stat_statements.tar.gz
Description: application/octet-stream (7.6 KB)
Attachment: ExecutorRun_hook.patch
Description: application/octet-stream (2.4 KB)

In response to

Responses

pgsql-hackers by date

Next:From: Decibel!Date: 2008-07-16 02:53:44
Subject: Re: Lookup penalty for VARIADIC patch
Previous:From: David FetterDate: 2008-07-16 01:57:38
Subject: Re: [PATCHES] WITH RECURSIVE updated to CVS TIP

pgsql-patches by date

Next:From: Tatsuo IshiiDate: 2008-07-16 04:57:04
Subject: Re: [PATCHES] WITH RECURSIVE updated to CVS TIP
Previous:From: David FetterDate: 2008-07-16 01:57:38
Subject: Re: [PATCHES] WITH RECURSIVE updated to CVS TIP

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