Sometimes SQL can be faster and sometimes not.
RPG uses the views of the file (logical view or physical if file is keyed).
If the view is helpful in getting what you want or need is a relatively small number of steps, it will appear to be fast. If you have a view that does not lend itself well to the application, then it will appear very slow.
For example:
You wish to get every address in a customer file with the street address "555 Main St."
Using RPG, you will have to set up a logical view of the file using the street address, then set lower limite and read until the street address does not begin with 555.
Using SQL, you can access only the spacifics you want, that is "555 Main St."
SQL is smart enough to find an access path to the data. If one exists, then it will use it. This is when SQL is fast. But, if it doesn't find one then it creates one temporarily. This is when it is slow.
So it is up to the programmer to know what is available and choose wisely.
Last Wiki Answer Submitted: July 28, 2009 7:20 pm by Rick53110 pts.
If you live outside the United States, by submitting your email address you consent to having your personal data transferred to and processed in the United States.
I do not see how SQL can be faster in this scenario.
hi Rick,
thanks for the answer.
However, RPG can access only the specific too. This is when you use the logical file and then use a key for “set lower limits” and a “read equal”.
I want to know specific instances or samples when and where SQL will be faster. I want to implement it in my coding if it really is faster.
Thanks!