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



I was going to suggest that, as I've always had very good results with
LOCATE in lieu of LIKE. But I cannot explain why this would be, so I
just kept quiet.

I use LOCATE regularly in filter fields on my subfile applications.
Always returns quickly...

-Eric DeLong

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Carel Teijgeler
Sent: Thursday, July 22, 2010 1:17 PM
To: midrange-l@xxxxxxxxxxxx
Subject: Re: Varying fields and SQL predicate LIKE

Should the LOCATE function not be considered? Something like (not really
sure about the correct syntax):

WHERE LOCATE(street, 'MAIN') > 0

With regards,
Carel Teijgeler

*********** REPLY SEPARATOR ***********

On 22-7-2010 at 10:07 CRPence wrote:

On 22-Jul-2010 08:12, Charles Wilt wrote:

I've got a 3.1 million row table with a 25 character field that holds
a
street address, ex. '123 MAIN ST.'

We currently perform seraches by address like so:
select * from myTable where address like '%MAIN%'

Given the leading '%', I know the search will require a full table
(perhaps full index) scan.

Given that the average TRIM'd length of the data in the field is 16
and
that RPG works much faster with varying fields. I was
thinking that if I changed the field to varying, the DB wouldn't have
any trailing blanks to compare too and thus my searches
should be about 36% faster...

However, I'm not seeing a 36% improvement. In fact, it appears that
performance is worse by a couple of percent!


Since a blank is not the prefix of the data being searched, you
could
not see the maximum potential improvement you are looking for.
Try searching on '% MAIN%' instead, to effect a better test; not that
I
trust the performance test results for both non-dedicated and
without averaged repeated tests including reversed order of any two
compared scenarios.

By the way, also try ALLOCATE(0) [or whatever syntax has that
effect]
to force all of the data into its own segment. Depending on
optimization, at the LIC DB level that storage could be the best
possible
means to reduce the I\O; the I\O is the greatest impediment
for completing the processing the quickest. If the query has the
capability to interrogate only the AuxSID, that could be similar to
an index-only access, whereby all of the processed data is effectively
contiguous.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.