|
Mark, Query engine performance is one of my little hobbies. In my experience, if the amount of data involved is significant, a PROPERLY TUNED opnqryf or SQL statement will perform as well as or better than an RPG program making the same selection. Note the emphasis on PROPERLY TUNED - if you just take the defaults, don't look at the tuning recommendations available under debug, and don't take your database structure and content into account when formulating your record selection and ordering criteria, then you're playing a crap shoot - maybe you win, maybe you don't. One biggie - look at the help text for the ALWCPY parameter, and use ALWCPY(*OPTIMIZE) when it fits, so that it will use the sort engine instead of the query engine when it's appropriate. There's TREMENDOUS power available with that. Also, if you don't make the complementary changes to your RPG to use the OPNQRYF output efficiently, you're artificially constraining the performance from the back end. For example, if you're just reading the OPNQRYF output sequentially, lose the 'K' in the F spec - you don't need it and it slows you down. Obviously, having your record selections in BOTH an OPNQRYF and RPG will slow you down as well. And if OPNQRYF is selecting the records, SETLL/READE processing is going to really slow it down. Dave Shaw Spartan International, Inc. Spartanburg, SC --- If you would like to subscribe to the MAPICS-L mailing list send email to MAPICS-L-SUB@midrange.com or go to www.midrange.com and follow the instructions. -----Original Message----- From: Mark A. Manske [mailto:mmanske@minter-weisman.com] Hi all; I am not sure if I am from the old school or the new - here is my question; I have proved in one particular program my way is more efficient; however I am wondering which way is "truly" more efficient as my IS manager was "taught" one way, and I forget now if I was taught or just out of being a "control freak" in RPG and not wanting to relinquish anything to C/L that I code the way I do... He has always tried to do opnqry before the program call to trim down the data as far as he can before calling the program - I do not have faith in opnqry as I have seen it drop records it should not have (PTF's "probably fixed this) so I tend to just take the file as is and code for my selection criteria. In a test today running it his way took 39 seconds, my way took 17 seconds. Now I do not know if this would hold true in all instances.. I guess I am wondering at a bare metal level, say you leave the key as is, but only put selection criteria in, does it matter... On the flip side, just how much system resources are "wasted" say for creating a opnqry over a file with a completely different key?? Any thoughts?? TIA Mark A. Manske [mailto:mmanske@minter-weisman.com] Sr. Project Lead Minter-Weisman +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.