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