Subject | Re: [firebird-support] tracking progress of a SP |
---|---|
Author | Hans |
Post date | 2005-03-21T00:30:58Z |
Found and example:
CREATE PROCEDURE "ACURSOR_FAST_UPDATE"
RETURNS
(
"STATUS1" TIMESTAMP,
"STATUS2" TIMESTAMP,
"STATUS3" TIMESTAMP
)
AS
DECLARE VARIABLE prod_name varchar(40);
declare variable prod_uniquenum integer;
BEGIN
status1 = 'now';
/* 2.5 times faster then next update loop */
FOR SELECT prod_name
FROM inventory FOR UPDATE
INTO :prod_name
AS CURSOR ACURSOR
DO BEGIN
UPDATE inventory SET prod_name = :prod_name
WHERE CURRENT OF ACURSOR;
END
status2 = 'now';
/* 2.5 times slower then previous update loop */
FOR SELECT prod_name,prod_uniquenum
FROM inventory FOR UPDATE
INTO :prod_name,:prod_uniquenum
DO BEGIN
UPDATE inventory SET prod_name = :prod_name
WHERE prod_uniquenum = :prod_uniquenum;
END
status3 = 'now';
SUSPEND;
END
CREATE PROCEDURE "ACURSOR_FAST_UPDATE"
RETURNS
(
"STATUS1" TIMESTAMP,
"STATUS2" TIMESTAMP,
"STATUS3" TIMESTAMP
)
AS
DECLARE VARIABLE prod_name varchar(40);
declare variable prod_uniquenum integer;
BEGIN
status1 = 'now';
/* 2.5 times faster then next update loop */
FOR SELECT prod_name
FROM inventory FOR UPDATE
INTO :prod_name
AS CURSOR ACURSOR
DO BEGIN
UPDATE inventory SET prod_name = :prod_name
WHERE CURRENT OF ACURSOR;
END
status2 = 'now';
/* 2.5 times slower then previous update loop */
FOR SELECT prod_name,prod_uniquenum
FROM inventory FOR UPDATE
INTO :prod_name,:prod_uniquenum
DO BEGIN
UPDATE inventory SET prod_name = :prod_name
WHERE prod_uniquenum = :prod_uniquenum;
END
status3 = 'now';
SUSPEND;
END
----- Original Message -----
From: "Alan McDonald" <alan@...>
To: <firebird-support@yahoogroups.com>
Sent: Sunday, March 20, 2005 2:44 PM
Subject: RE: [firebird-support] tracking progress of a SP
>
> I was trying to track the internal progress of a SP that was running
> quite slow.
>
> I created an external table, then wrote to the table at various
> points from within the SP and updated using CURRENT_TIME and a note
> field. Of course, as I later learned from the documentation the
> CURRENT_TIME was set at the beginning of the SP and never
> incremented.
>
> I finally figured out what was causing the slow processing, but I
> would like to know for the future if something like this is
> possible. I tried to Google, but only got information as to why it
> doesn't work.
>
> Is there any way to get a real CURRENT_TIME from within a SP?
>
> Thanks,
>
> Rick
>
> use 'NOW' instead of CURRENT_TIME
> Alan
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>