|
I was working on improving performance and got some interesting
results. I have some embedded SQL which includes a PREPARE, DECLARE,
OPEN and FETCH. I have the exact same code in a program as in a
service program. I am logging the start and end time just for the
FETCH. I start the time just after the OPEN and end the time just
after the FETCH.
The FETCH in the Service program is taking about 800000 ms and the
FETCH in the program is taking about 1000 ms.
The time to call the service program 10 times was 9.2 seconds versus
.53 seconds for the program. Has anyone else seen this where the
actual SQL Fetch takes longer if it is in a service program?
The program and the service program are both Activation Group *CALLER
and compiled with the same SQL options.
I called the service program and program 10 times each. The ACCT#/* correlation name clause AS something best here */
gets replaced with each call. The service program and the program
both fetch the same number of rows.
WITH
t AS
( SELECT ROW_NUMBER()
OVER( ORDER BY ACCOUNTID ASC
, ORDERDATE DESC
, INVDATE DESC
, INVNUMBER ASC
) AS row_number
, ORDINQV.*
FROM ORDINQV
where ( ORDINQV.accountid = 'ACCT#')/* correlation id is unnecessary here */
)
SELECT *
FROM t
WHERE row_number >= 1
FOR READ ONLY
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.