Charles

First blush - do a DSPPFM F10 F11 and verify that the length in the first 2 bytes actually reflects the trimmed length. When I've needed to change to varying in the DB, I've used the STRIP function in an SQL UPDATE statement with no WHERE clause - unless you wanted to use a condition that length(field) <> length(strip(field))!

HTH
Vern

On 7/22/2010 10:12 AM, Charles Wilt wrote:
All,

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!

Any thoughts as to why this is the case?

I've double checked the following:
- The varying field is set ALLOCATE(25)
- The data in the varying field is TRIM'd

Thanks!
Charles

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.