× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



David,

How big is your test file? It could be that the optimizer decided to do a
file scan in the first instance rather than create a temporal index, and
that could account for the time difference.

Also, any particular reason you are not using static (as opposed to
dynamic(PREPARE)) SQL? IIRC Static should be faster.

I agree with the other posters in trying to check iNav's Visual Explain
(Select Execute and Explain from the iNav's SQL Script window). If running
in a green-screen environment, run STRDBG before your program and check the
job log's messages.

HTH,
Luis Rodriguez
IBM Certified Systems Expert — eServer i5 iSeries
--



On Mon, Mar 7, 2011 at 10:26 AM, David FOXWELL <David.FOXWELL@xxxxxxxxx>wrote:


Hi all,

I am having a strange performance issue while loading a subfile from an sql
cursor.
It seems that when the sql select gets run and no index can be used, it is
MUCH faster than when an index can be used.

I have 2 transaction files , currentTransactions and historyTransactions.
Both these files have logicals with the client number as the first key
field.

I am using sql to search these files with any range of client numbers and a
transaction amount. I am doing something like :
select fields from files where clientNumber between c1 and c2 and amount
between a1 and a2

No index has yet been created for the transaction amount. I am now testing
to see what the performance is like.

If I enter an amount 20.25 and no client number, my statement will be
something like :
select fields from files where clientNumber between 0 and 999999 and
amount between 20.25 and 20.25

If I enter client number 12345 and no amount, my statement will be
something like :
select fields from files where clientNumber between 12345 and 12345 and
amount between 0 and 9999999999.99

The first statement is running twice as fast than the second, which I don't
understand. They are both taking several seconds to run.

I've tried debugging and copying and pasting the result into an iNav sql
script window and it runs in a split second.

I thought maybe it was other logic between reading the cursor and writing
to the subfile, but if I enter no client and no amount, the subfile displays
immediately.

any ideas would be most welcome.
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.