×
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.
Hi,
I have the following SQL statement that will be executed in an RPG program and I'm trying to speed it up.
select a.FLD1, a.FLD2, a.FLD3, a.FLD4, a.FIRSTNME, a.MIDDLENME, a.LASTNME , a.HISTC , b.ADDRL1, b.CITY, b.STATE from FILE1 a left outer join FILE2 b on a.FLD1 = b.FLD1 where a.HISTC in ( 'C' , 'D' , 'F' ) and ( (b.STATE = 'OH' and upper(b.CITY) = 'DOVER' and upper(b.ADDRL1) like '110%' and ( upper(a.LASTNME) like 'MITC%' or upper(a.FIRSTNME) like 'JO%' ) ) or ( upper(a.LASTNME) = 'MITCHELL' and upper(a.FIRSTNME) like 'J%' and a.FLD2 = 1994 and a.FLD3 = 9 and a.FLD4 = 23 ) ) order by a.LASTNME, a.FIRSTNME, a.MIDDLENME
There are about 1.2 million records in FILE1 and 548,000 in FILE2. I have used Visual Explain to see if it recommended any indexes, and ended up creating one over FILE1 by the HIST field. There are existing logicals keyed by the join fields. All of the comparison values for the various fields will change based on what the user enters. The only one that won't change is the values for the HIST field. The query takes about 1 to 2 minutes to execute when running it from the SQL scripts window in System I Navigator. It is being used in an interactive application, so I would like to make it as fast as possible.
I created a join logical between FILE1 and FILE2 and keyed it by LASTNME, FIRSTNME and MIDDLENME since that is the order by clause. I also selected on the HIST values. Then, I ran the statement specifying the logical, but that didn't seem to help much. Would the UPPER function have much of an impact? Is there a way to avoid using that? Maybe there isn't much that can be done, but I thought I would throw it out here and see if anyone has a suggestion. TIA
Dean Eshleman
Software Development Architect
Everence Financial
1110 North Main Street
PO Box 483
Goshen, IN 46527
Phone: (574) 533-9515 x3528
www.everence.com<
http://www.everence.com>
________________________________
Confidentiality Notice: This information is intended only for the individual or entity named. If you are not the intended recipient, do not use or disclose this information. If you received this e-mail in error, please delete or otherwise destroy it and contact us at (800) 348-7468 so we can take steps to avoid such transmission errors in the future. Thank you.
As an Amazon Associate we earn from qualifying purchases.