× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Thanks Gary,
I am using an 'ORDER by' clause.  There is only 1 key field it definately
matches.

I am also using 'Select *' so i will change that around and see if that
helps.

do you know where i can find out more info regarding the optimizer and how
it determines what it will use?

-----Original Message-----
From: Gary Guthrie [mailto:garyguthrie@charter.net]
Sent: Monday, February 11, 2002 11:35 AM
To: rpg400-l@midrange.com
Subject: Re: SQL query optimization


Could be many reasons. The query optimizer makes predictions based on
several criteria such as the type of selection clauses you use (=, >, <,
etc.), fields in order by or group by clauses, and on and on.

If you are not specifying an order by clause, you MAY be able to force
the optimizer to use a certain access path by including an order by
clause that matches the key sequence.

Also, you can often force the optimizer to use a particular access path
by selecting only those fields in the access path rather than using
Select *.

It's a complex beast - too complex to fully explain here.

Gary Guthrie
Senior Technical Editor, iSeries NEWS




"Smith, Mike" wrote:
>
> I have an embedded SQL program that I have noticed a delay on the OPEN
> CURSOR.  After running it through debug, i find that it is creating a
> 'Temporary result file' CPI4325 with reason code of '7' which says that
the
> optimizer decided to do a sort rather than an access path.
> The file has a Key on it, in the order that i have selected on my SQL
> statement.  So i thought(ok, it doesn't like the key on the physical.) SO
i
> created a logical file with the proper key.  I still get the same thing
> happening.
>
> Does any one have any ideas.
>
> Why is it not using the access path of my logical?
> suggesstions!!
_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
or email: RPG400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.