SQL vs RPG: Which is faster?

560 pts.
Tags:
RPG
SQL
Which is faster? Getting a certain number of records using a cursor with SQL or using native I/O's SetLL & ReadE?

Answer Wiki

Thanks. We'll let you know when a new response is added.

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.

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • bogeybetsy
    I do not see how SQL can be faster in this scenario.
    560 pointsBadges:
    report
  • bogeybetsy
    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!
    560 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following