<i><font color="#663300">In one of my recent project, I noticed a signifiacnt performance difference in REQUERY(). When 'Purcahse Order Line Items' table is REQUERY()-ed from command window, it takes SIGNIFICANTLY less time than REQUERY() issued through 'Purchase Order' form.
This is how I tested it:
(1) In cDataBehavior.Requery() I have added the following lines: *-----{ DEBUG LINES LOCAL lnStartTime, lnEndTime lnStartTime = SECONDS() lnRetVal = REQUERY() && CodebookLine lnEndTime = SECONDS() WAIT WINDOW "Time taken: " + STR(lnEndtime - lnStarttime,7,3) + " second(s)" *-----} END DEBUG LINES
(2) Created TestRequery.prg and added the following lines
LOCAL vp_cfkPO, lnStartTime, lnEndTime SET PATH TO dsdmatplusdata && data is in a network computer same as (1) OPEN DATABASE matplus && This is the project database vp_cfkPO = "0252" && view parameter linking purchase order USE lv_po_items_crud && purchase order line items view vp_cfkPO = "0137" && to get same line items as (1) lnStartTime = SECONDS() REQUERY() lnEndtime = SECONDS()
? "Time taken: ", lnEndtime - lnStartTime, " second(s)"
NOTE: A) In (1) the DATA path was set to the same location as (2). B) In (1) the Line Items had the same foreign key as (2) and the Requiery() was for line items only. C) The DATA forder was in a network computer to feel the difference clearly.
REUSLTS: For (1):4.256 seconds For (2): 0.064 seconds
THE QUESTION: (A) Can any one tell me why the huge time difference? (B) Is this happening to me only?
TIA A Datta</font></i>
A) Try to reboot your computer between tests or reverse the order of the tests becuase you may get opposite results. Requey takes significant longer the first time it is done. The data is loaded into memory, so the second one is much faster. I have had it over 1000x faster the second time. The amount of memory that Codebook takes also affects the query speed - If you have < 128 MB and are having speed issues, this is the place to start. B) I have experianced this to an even greater factor when I was on a slow machine and only had 64MB of memory. I query that took 20 minutes on my machine took 2 seconds on another machine! Todd Haehn ©2002 Todd Haehn |