profiling plpgsql functions..

Поиск
Список
Период
Сортировка
Искать

profiling plpgsql functions..

От:
Rajesh Kumar Mallah <mallah@trade-india.com>
Дата:


Is printing timeofday() at various points a good idea
of profiling plpgsql functions?

also is anything wrong with following fragment ?
RAISE INFO '' % , message here ... '' , timeofday() ;


regds
mallah.

-- 
Rajesh Kumar Mallah,
Project Manager (Development)
Infocom Network Limited, New Delhi
phone: +91(11)6152172 (221) (L) ,9811255597 (M)

Visit http://www.trade-india.com ,
India's Leading B2B eMarketplace.

Re: profiling plpgsql functions..

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Rajesh Kumar Mallah  writes:
> Is printing timeofday() at various points a good idea
> of profiling plpgsql functions?

Sure.

> also is anything wrong with following fragment ?
> RAISE INFO '' % , message here ... '' , timeofday() ;

IIRC, RAISE is pretty slovenly implemented :-( ... it will only take
plain variable references as additional arguments.  So you'll have to
do

		var := timeofday();
		RAISE INFO ''... '', var;

I believe timeofday() produces TEXT, so declare the var that way.

			regards, tom lane

Re: profiling plpgsql functions..

От:
<mallah@trade-india.com>
Дата:

Yep timeofday returns text , but is there anything else
that equivalant that can be differenced inside plpgsql
so that i can print the not of secs/millisecs connsumed?

hmm shud i cast timeofday to timestamp  and use timestamp
arithmatic ?

regds
mallah.

> Rajesh Kumar Mallah  writes:
>> Is printing timeofday() at various points a good idea
>> of profiling plpgsql functions?
>
> Sure.
>
>> also is anything wrong with following fragment ?
>> RAISE INFO '' % , message here ... '' , timeofday() ;
>
> IIRC, RAISE is pretty slovenly implemented :-( ... it will only take plain variable references
> as additional arguments.  So you'll have to do
>
> 		var := timeofday();
> 		RAISE INFO ''... '', var;
>
> I believe timeofday() produces TEXT, so declare the var that way.
>
> 			regards, tom lane



-----------------------------------------
Get your free web based email at trade-india.com.
   "India's Leading B2B eMarketplace.!"
http://www.trade-india.com/

Re: profiling plpgsql functions..

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
 writes:
> hmm shud i cast timeofday to timestamp  and use timestamp
> arithmatic ?

Yeah.  It's only historical accident that it doesn't return timestamp...
(or better use timestamptz)

			regards, tom lane

Re: profiling plpgsql functions..

От:
Rajesh Kumar Mallah <mallah@trade-india.com>
Дата:


the profiling was really helpful to track down 
an absense of an appropriate index.

believe me or not  the overall speed improvement was 50 times :))

from the order of .4 sec to .008 secs per function call

regds
mallah.



On Tuesday 29 Apr 2003 9:31 pm, Tom Lane wrote:
>  writes:
> > hmm shud i cast timeofday to timestamp  and use timestamp
> > arithmatic ?
>
> Yeah.  It's only historical accident that it doesn't return timestamp...
> (or better use timestamptz)
>
> 			regards, tom lane
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

-- 
Rajesh Kumar Mallah,
Project Manager (Development)
Infocom Network Limited, New Delhi
phone: +91(11)6152172 (221) (L) ,9811255597 (M)

Visit http://www.trade-india.com ,
India's Leading B2B eMarketplace.

FAQ