From: Tom Lane <tgl@sss.pgh.pa.us>
To: ITAGAKI Takahiro <itagaki.takahiro@oss.ntt.co.jp>
Cc: Simon Riggs <simon@2ndquadrant.com>
Cc: pgsql-hackers@postgresql.org
Subject: Re: [PATCHES] WIP: executor_hook for pg_stat_statements
Date: Thu, 10 Jul 2008 16:11:42 -0400
Message-ID: <13432.1215720702@sss.pgh.pa.us> (raw)
In-Reply-To: <20080708091907.6D35.52131E4D@oss.ntt.co.jp>
References: <1215414601.4051.432.camel@ebony.site>
<10029.1215442263@sss.pgh.pa.us>
<20080708091907.6D35.52131E4D@oss.ntt.co.jp>
ITAGAKI Takahiro <itagaki.takahiro@oss.ntt.co.jp> writes:
> Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I don't want the tag there at all, much less converted to a pointer.
>> What would the semantics be of copying the node, and why?
>>
>> Please justify why you must have this and can't do what you want some
>> other way.
> In my pg_stat_statements plugin, the tag is used to cache hash values of
> SQL strings in PlannedStmt. It is not necessarily needed because the hash
> value is re-computable from debug_query_string. It is just for avoiding
> the work. In addition, we see different SQLs in debug_query_string in
> PREPARE/EXECUTE and DECLARE/FETCH. Hashed SQL cache can work on those
> commands.
Actually, that aspect of the plugin is 100% broken anyway, because it
assumes that debug_query_string has got something to do with the query
being executed. There are any number of scenarios where this is a bad
assumption.
I wonder whether we ought to change things so that the real query
source text is available at the executor level. Since we are (at least
usually) storing the query text in cached plans, I think this might just
require some API refactoring, not extra space and copying. It would
amount to a permanent decision that we're willing to pay the overhead
of keeping the source text around, though.
Also, after looking at the patch more closely, was there a good reason
for making the hook intercept ExecutePlan rather than ExecutorRun?
ExecutePlan was never intended to have a stable public API --- its
argument list is just a happenstance of what ExecutorRun needs to
fetch for its own purposes. I think we should keep it private and
have ExecutorRun do
if (hook)
hook(...);
else
standard_ExecutorRun(...);
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-patches@postgresql.org
Cc: tgl@sss.pgh.pa.us, itagaki.takahiro@oss.ntt.co.jp, simon@2ndquadrant.com, pgsql-hackers@postgresql.org
Subject: Re: [PATCHES] WIP: executor_hook for pg_stat_statements
In-Reply-To: <13432.1215720702@sss.pgh.pa.us>
References: <1215414601.4051.432.camel@ebony.site> <10029.1215442263@sss.pgh.pa.us> <20080708091907.6D35.52131E4D@oss.ntt.co.jp> <13432.1215720702@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox