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



Justin

In reply to your earlier bit here - might be different environments - if you run a SELECT interactively, the default goal is to get first IO - if in a batch environment, default goal is to get the whole thing, basically.

So there might be different choices of what is optimum for each - hence, you get a different LF or index used.

Run SQL Scripts is a kind of batch environment, even though you are interactively using it from your viewpoint, right?

At least I think I memrember this correctly!

Cheers
Vern

On 6/29/2018 11:12 AM, Justin Taylor wrote:
I forgot to include this message from the app debug data:
Temporary result file built for query.
7 - The query optimizer chose to use a sort rather than an access path to order the results of the query.

That's why I'm thinking an index for the ORDER BY.



From: Justin Taylor
Sent: Friday, June 29, 2018 10:41 AM
To: MIDRANGE-L (midrange-l@xxxxxxxxxxxx) <midrange-l@xxxxxxxxxxxx>
Subject: CURSOR-Table Scan vs Index Scan

SQL Performance Center shows that this query (from embedded SQL) performs a Table Scan (runtime 420ms):
declare POCSR cursor for select PO# , INV , STK , DESCR1 , DESCR2 , DESCR3 from PO where STK like : H or DESCR1 like : H or DESCR2 like : H or DESCR2 like : H order
by INV , PO# desc for read only

I ran the same query in Run SQL Scripts, substituting the same literal for :H. That uses an Index Scan (runtime 95ms).

Run SQL Scripts is using a LF keyed on INV. Debug data for the app shows that LF wasn't selected for this reason:
17 - The left-most key of the access path did not match any fields specified for the selection criteria. Therefore, key row positioning could not be performed, making the cost to use this access path higher than the cost associated with the chosen access method.

I have a standard index over (INV, PO#, x). I'm thinking about creating a new index over only (INV, PO#). Would a standard or EVI index work better?

TIA


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.