Thread: profiling plpgsql functions..
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.
Rajesh Kumar Mallah <mallah@trade-india.com> 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
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 <mallah@trade-india.com> 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/
<mallah@trade-india.com> 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
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: > <mallah@trade-india.com> 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.