RE: CUURENT in Stored Procedure
Posted in 2006
Topics: Stored Procedures & SPL, Internationalization & Character Sets
CURRENT will take the timestamp value at the point the SP started execution.
USEOSTIME=0 force the DB to take it's time from the OS, USEOSTIME=1 makes
the server maintain it's own timer which will slow it down.
Regards
Colin
There are 10 types of people in the world, those that understand binary and
those that don't
>From: "David Reed" <david.reed@tollink.co.za>
>To: <informix-list@iiug.org>
>Subject: CUURENT in Stored Procedure
>Date: Wed, 20 Sep 2006 14:21:16 +0200
>
>I use SCO OpenServer 5.x and Informix 7.x
>My USEOSTIME is set to 1 (Seems if this only enable the fraction part)
>The date_stamp is declared as DATETIME YEAR TO FRACTION(5)
>
>Maybe this question was asked before, but I would like to ask it again.
>If I use CURRENT at different places in a stored procedure, I get the
>same values. I would like the Stored Procedure to log in milliseconds
>the time it takes to execute. I would like to get the time in the
>beginning and then also at the end of the procedure.
>
>I have replaced the CURRENT with another stored procedure that I call
>that use CURRENT, but no luck. Any help please?
>
>Example:
>CREATE PROCEDURE sp_check_speed()
> DEFINE l_start_time DATETIME YEAR TO FRACTION(5);> DEFINE l_end_time DATETIME YEAR TO FRACTION(5);
> LET l_start_time = CURRENT;
> {Do lot of work and selects, take about 3 second}
> LET l_end_time = CURRENT;
> {Write the Start and End time into a table, but the time is the
>same}
>END PROCEDURE;
>
>Regards
>David
>_______________________________________________
>Informix-list mailing list
>Informix-list@iiug.org
>http://www.iiug.org/mailman/listinfo/informix-list
_________________________________________________________________
Windows Live' Messenger has arrived. Click here to download it for free!
http://imagine-msn.com/messenger/launch80/?locale=en-gb
Colin Dawson wrote:
> CURRENT will take the timestamp value at the point the SP started
> execution.
Or the statement that invokes the stored procedure if it is invoked as
part of another SQL statement, rather than via EXECUTE PROCEDURE.
> USEOSTIME=0 force the DB to take it's time from the OS, USEOSTIME=1
> makes the server maintain it's own timer which will slow it down.
I think you have your 0 and 1 reversed.
>> From: "David Reed" <david.reed@tollink.co.za>
>> To: <informix-list@iiug.org>
>> Subject: CUURENT in Stored Procedure
>> Date: Wed, 20 Sep 2006 14:21:16 +0200
>>
>> I use SCO OpenServer 5.x and Informix 7.x
>> My USEOSTIME is set to 1 (Seems if this only enable the fraction part)
>> The date_stamp is declared as DATETIME YEAR TO FRACTION(5)
>>
>> Maybe this question was asked before, but I would like to ask it again.
>> If I use CURRENT at different places in a stored procedure, I get the
>> same values. I would like the Stored Procedure to log in milliseconds
>> the time it takes to execute. I would like to get the time in the
>> beginning and then also at the end of the procedure.
>>
>> I have replaced the CURRENT with another stored procedure that I call
>> that use CURRENT, but no luck. Any help please?
>>
>> Example:
>> CREATE PROCEDURE sp_check_speed()
>> DEFINE l_start_time DATETIME YEAR TO FRACTION(5);>> DEFINE l_end_time DATETIME YEAR TO FRACTION(5);
>> LET l_start_time = CURRENT;
>> {Do lot of work and selects, take about 3 second}
>> LET l_end_time = CURRENT;
>> {Write the Start and End time into a table, but the time is the
>> same}
>> END PROCEDURE;
That's the way the SQL standard requires time to behave. Slap a 'SYSTEM
"sleep 300"' statement in there and it will report the same time.
There is a way to find the 'real' time - poke around groups.google.com
for DBINFO and SPL and TIME (say since 2000-01-01); various other people
have asked the question and been answered.
--
Jonathan Leffler #include <disclaimer.h>
Email: jleffler@earthlink.net, jleffler@us.ibm.com
Guardian of DBD::Informix v2005.02 -- http://dbi.perl.org/