Re: current function in long running strored procedure
Posted in 1998
WF Software wrote:
>
> In article <35A9E5C5.8DD6580E@procent.hu>, wolf.p@procent.hu (Wolf Peter)
> wrote:
>
> > HOW can I GET the real current time in stored procedure call?
> >
> > These test program proofs that the built-in current function in a stored
> > procedure the procedure returns the time when the procedure BEGAN not
> > the CURRENT time!
> >
> >
> > create procedure test() returning datetime year to second;> >
> > define i int;
> >
> > for i= 1 to 5
> > return current do with resume;
> > system( 'sleep 3' );
> > end for;
> >
> > end procedure;
> >
> > The execute procedure test()
> > returns
> > 1998-07-13 11:33:53
> > 1998-07-13 11:33:53
> > 1998-07-13 11:33:53
> > 1998-07-13 11:33:53
> > 1998-07-13 11:33:53
> >
> >
> >
> Sorry this is a feature, CURRENT is set when the first SPL is run and
> AFAIK all subsequent SPL calls from within the initial SPL will inherit
> this value. If you really need the value you can drop to the OS but I've
> found this gives a typical overhead of about 0.5s per call, which can be
> significant depending on your system.
>
> Paul Watson
> WF Software Ltd.
> Tel. (+44) 1436 674729
> Fax. (+44) 1436 678693
The reasoning behind this is that transactions are supposed to be atomic
and "instant". Remember, SQL is designed to be a language for processing
relations over many implementations. Many features of the language are
deliberately designed to hide implementation details, a significant one
of which is speed :-). So, CURRENT is defined to be the same throughout
a transaction and is therefore no use for timing transaction duration.
Portability and abstraction are just like everything else: no gain
without pain.
--
Peter Lancashire
Information Systems Specialist, Bayer plc
Eastern Way, Bury St Edmunds, Suffolk, IP32 7AH, UK
Tel: +44-1635-562258, Fax: +44-1635-562281
---
If all else fails, read the instructions.
All opinions are my own and not those of Bayer plc.
My Internet plumbing does not allow me to mail and post news together.
Sorry.
---
Join Infuse, the UK Informix User Group at http://www.infuse.org.uk/