|
Matt, ALWCPYDTA did the trick. Thanks to all who replied, Steve -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Haas, Matt Sent: Thursday, November 13, 2003 3:53 PM To: RPG programming on the AS400 / iSeries Subject: RE: Embedded SQL performance question. Steve, Try experimenting with the ALWCPYDTA compile option. It defaults to *OPTIMIZE which I've found to cause performance problems in certain situations. In our case, setting it to *YES fixed the performance problem. Also, if you read through the SQL book that explains the query optimizer, it will mention that it doesn't really like logicals with selection criteria in it. If the compile setting doesn't fix your problem, try building a new logical without selection criteria. Matt -----Original Message----- From: Steve Cross [mailto:SCross@xxxxxxxxxxxxxxxx] Sent: Thursday, November 13, 2003 4:27 PM To: RPG programming on the AS400 / iSeries Subject: RE: Embedded SQL performance question. Joel, Yes the logical file has select criteria. The SQL "Order By" statement matches the key to the logical, but the low level message says the optimizer chose to build its own path (takes 3 minutes), rather than using the logical (It thought it would be faster). Running STRSQL using the same SQL statement finds the correct logical and immediately displays the data. Is there a way to tell the SQL engine not to find its own path, but instead use the logical we defined in the SQL statement? Thanks, Steve -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Joel Cochran Sent: Thursday, November 13, 2003 9:33 AM To: RPG programming on the AS400 / iSeries Subject: Re: Embedded SQL performance question. Does the Logical have any select and omit criteria? Joel http://www.rpgnext.com On Thu, 2003-11-13 at 19:34, Steve Cross wrote: > Hi, > > I have an embedded SQL statement in my RPG program > > It's a typical select statement over a logical file. > > the where selections and the order by are against the 1st two primary > key fields. > > when I execute this statement using Interactive SQL it runs fine. > quick response and debug says it chose the logical access path > > when I run it in the RPG program the optimizer builds its own access > path and takes 3 minutes to execute. > > the statements are identical. > > what am I doing wrong. I am running OS V5R2 > > Thanks in advance, > Steve
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.