|
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 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.