pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dave Cramer <pg@fastcrypt.com>
To: Bruce Momjian <bruce@momjian.us>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Oliver Jowett <oliver@opencloud.com>
Cc: Csaba Nagy <nagy@ecircle-ag.com>
Cc: Postgres JDBC <pgsql-jdbc@postgresql.org>
Subject: Re: PGStatement#setPrepareThreshold
Date: Fri, 4 Aug 2006 15:16:12 -0400
Message-ID: <A9AE463A-4B1E-46EC-94E7-035BEA53CD6E@fastcrypt.com> (raw)
In-Reply-To: <200608041856.k74IurK20224@momjian.us>
References: <200608041856.k74IurK20224@momjian.us>

Bruce,

Doesn't it make more sense to use the statement name ?

If I prepare S_3 as "select * from foo"

then the bind log is going to show me "select * from foo" not S_3

I think in the case of named statements I'd prefer "S_3" however as I  
think about this in the case of unnamed statements I'd prefer the  
"select * from foo"

Comments ?

Dave
On 4-Aug-06, at 2:56 PM, Bruce Momjian wrote:

> bruce wrote:
>> Tom Lane wrote:
>>> Bruce Momjian <bruce@momjian.us> writes:
>>>> Dave Cramer wrote:
>>>>> Bind also has a statement name, as well as a portal name ?
>>>>>
>>>>> Ideally I'd like to see the parameters which were bound and the
>>>>> types, but I suspect I'm reaching here.
>>>
>>>> Right, but do we want to repeat the statement for every bind case?
>>>
>>> My upthread proposal was to print the statement and portal names
>>> at bind time.  The current printout is very clearly inadequate.
>>
>> Sure, I can do that.
>>
>> Did you like my idea of?
>>
>> 	statement:  <protocol execute> ...
>>
>> You didn't reply.  I want to keep the "statement:" prefix for scripts
>> that process our log files, and because it is output by  
>> log_statement,
>> which controls protocol output as well.
>
> I have applied this patch to output the statemented referenced by  
> BIND.
> I also changed the "[protocol]" string to "<protocol>" for clarity.  I
> am ready to pull PREPARE|BIND|EXECUTED into the "protocol" bracket too
> if someone says that is a good idea.
>
> -- 
>   Bruce Momjian   bruce@momjian.us
>   EnterpriseDB    http://www.enterprisedb.com
>
>   + If your life is a hard drive, Christ can be your backup. +
> Index: src/backend/tcop/postgres.c
> ===================================================================
> RCS file: /cvsroot/pgsql/src/backend/tcop/postgres.c,v
> retrieving revision 1.493
> diff -c -c -r1.493 postgres.c
> *** src/backend/tcop/postgres.c	29 Jul 2006 03:02:56 -0000	1.493
> --- src/backend/tcop/postgres.c	4 Aug 2006 18:50:59 -0000
> ***************
> *** 1146,1153 ****
>
>   	if (log_statement == LOGSTMT_ALL)
>   		ereport(LOG,
> ! 				(errmsg("statement: [protocol] PREPARE %s AS %s",
> ! 						(*stmt_name != '\0') ? stmt_name : "<unnamed>",
>   						query_string)));
>
>   	/*
> --- 1146,1153 ----
>
>   	if (log_statement == LOGSTMT_ALL)
>   		ereport(LOG,
> ! 				(errmsg("statement: <protocol> PREPARE %s AS %s",
> ! 						*stmt_name ? stmt_name : "<unnamed>",
>   						query_string)));
>
>   	/*
> ***************
> *** 1452,1458 ****
>   	/* We need to output the parameter values someday */
>   	if (log_statement == LOGSTMT_ALL)
>   		ereport(LOG,
> ! 				(errmsg("statement: [protocol] <BIND> %s", portal_name)));
>
>   	/*
>   	 * Fetch parameters, if any, and store in the portal's memory  
> context.
> --- 1452,1460 ----
>   	/* We need to output the parameter values someday */
>   	if (log_statement == LOGSTMT_ALL)
>   		ereport(LOG,
> ! 				(errmsg("statement: <protocol> <BIND> %s  [PREPARE:  %s]",
> ! 						*portal_name ? portal_name : "<unnamed>",
> ! 						portal->sourceText ? portal->sourceText : "")));
>
>   	/*
>   	 * Fetch parameters, if any, and store in the portal's memory  
> context.
> ***************
> *** 1718,1726 ****
>   	if (log_statement == LOGSTMT_ALL)
>   		/* We have the portal, so output the source query. */
>   		ereport(LOG,
> ! 				(errmsg("statement: [protocol] %sEXECUTE %s  [PREPARE:  %s]",
>   						execute_is_fetch ? "FETCH from " : "",
> ! 						(*portal_name) ? portal_name : "<unnamed>",
>   						portal->sourceText ? portal->sourceText : "")));
>
>   	BeginCommand(portal->commandTag, dest);
> --- 1720,1728 ----
>   	if (log_statement == LOGSTMT_ALL)
>   		/* We have the portal, so output the source query. */
>   		ereport(LOG,
> ! 				(errmsg("statement: <protocol> %sEXECUTE %s  [PREPARE:  %s]",
>   						execute_is_fetch ? "FETCH from " : "",
> ! 						*portal_name ? portal_name : "<unnamed>",
>   						portal->sourceText ? portal->sourceText : "")));
>
>   	BeginCommand(portal->commandTag, dest);
> ***************
> *** 1826,1836 ****
>   								secs, msecs)));
>   			else
>   				ereport(LOG,
> ! 						(errmsg("duration: %ld.%03d ms  statement: [protocol] % 
> sEXECUTE %s  [PREPARE:  %s]",
>   								secs, msecs,
>   								execute_is_fetch ? "FETCH from " : "",
> ! 								(*portal_name) ? portal_name : "<unnamed>",
> ! 							portal->sourceText ? portal->sourceText : "")));
>   		}
>   	}
>
> --- 1828,1838 ----
>   								secs, msecs)));
>   			else
>   				ereport(LOG,
> ! 						(errmsg("duration: %ld.%03d ms  statement: <protocol> % 
> sEXECUTE %s  [PREPARE:  %s]",
>   								secs, msecs,
>   								execute_is_fetch ? "FETCH from " : "",
> ! 								*portal_name ? portal_name : "<unnamed>",
> ! 								portal->sourceText ? portal->sourceText : "")));
>   		}
>   	}
>




view thread (28+ messages)  latest in thread

Message-ID: <A9AE463A-4B1E-46EC-94E7-035BEA53CD6E@fastcrypt.com>
Permalink:  ../A9AE463A-4B1E-46EC-94E7-035BEA53CD6E@fastcrypt.com/
Also on:    postgresql.org/message-id/A9AE463A-4B1E-46EC-94E7-035BEA53CD6E@fastcrypt.com

 · 

reply

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-jdbc@postgresql.org
  Cc: pg@fastcrypt.com, bruce@momjian.us, tgl@sss.pgh.pa.us, oliver@opencloud.com, nagy@ecircle-ag.com
  Subject: Re: PGStatement#setPrepareThreshold
  In-Reply-To: <A9AE463A-4B1E-46EC-94E7-035BEA53CD6E@fastcrypt.com>
  References: <200608041856.k74IurK20224@momjian.us> <A9AE463A-4B1E-46EC-94E7-035BEA53CD6E@fastcrypt.com>

* 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