My application slows waaaay down on an open cursor - HELP!
Posted in 1994
Topics: Migration, Import/Export & Data Conversion
Here is a real good one. I have this inventory query application that was just cruising along all happy, when one day it stops performing worth shit when the users had the gall to use wildcards. It had accepted wildcards fine previously and other item lookup functions that access the same item master table *still* work with wildcards. For example, we have item codes RHR68C and RHR68J. This function (let's call it iqq) works great when the user enters either one of these on its own. But, if the enter RHR68*, it takes several minutes to return the info. There is another function called im that will work when using the RHR68* query criteria. iqq accesses 3 tables (item, itembrch, itemplan) whereas im only accesses item. I have unloaded/dropped/rebuilt/reloaded each of the 3 tables used by the offending program. This did not help. There are no invalid duplicate indexes in any of these tables. Informix tech support can't help me, my vendor tech support can't help me. Here is the code that leads up to the hang: let query_item = "select item.id_item, item.desc1_item, item.xref_item,", "item.uom_item,item.alteruom_item,", "item.altstkcnv_item,item.branchctl_item,", "item.whsectl_item,item.binctl_item,", "item.lotserctl_item,item.qtyctl_item,", "item.qtyperpack_item,item.location_item,", "item.listprice_item,item.suggretail_item,", "itembrch.onhand_ibr,", "itembrch.commtd_ibr,itembrch.onorder_ibr,", "itemplan.intransit_ipm,itemplan.mrb_ipm,", "itembrch.item_ibr,itembrch.branch_ibr", " from item, itemplan, itembrch", " where item.id_item = itemplan.id_ipm AND ", where_item clipped, " and item.id_item = itembrch.item_ibr", " and itembrch.branch_ibr = 1", " and (item.itemstat_item is null or", " item.itemstat_item NOT IN ('3', '4'))", " order by id_item" prepare itemget from query_item declare item_set scroll cursor for itemget open item_set fetch first item_set into item_rec.* ------------------------------------ where_item clipped is correct in each instance that I have mentioned. The program "hangs" (or more appropriately, "dogs") on the "open item_set" statement. Does anyone have any ideas? Thanks in advance NOW THAT I HAVE YOUR ATTENTION!!!!! I have this other application that is used to view a customer's a/r history. This application craps out with a -408 for one particular customer of ours. Again, I unloaded/dropped/rebuilt/loaded the tables used in this program to no avail. The funny thing is if I go into the view and select another customer and then run it with the problem customer, it works fine. It only craps out if the first view I do is for that particular customer. Again, my vendor tech support shrugs their shoulders and Informix seems just as baffled. Can anyone point me in a useful direction? Thanks in advance! Are we having fun yet? Jay King Silo Music Distribution satco!jay@sadye.EMBA.UVM.EDU