Skip to Content
Former Member
Apr 03, 2013 at 05:28 AM

Select query executing very slow the first time.


Hi All,

I am using a query in my custom function module. This query takes too long to execute the first time in a day. From second time onwards it takes just seconds to execute.

SELECT p~lgnum p~tanum p~tapos p~matnr t~maktx AS matkx
p~charg p~werks p~umrez AS umrez_sku_r p~umren AS umren_sku_l
p~meins AS meins_r p~altme AS altme_l p~nistm AS nistm
p~letyp p~vltyp p~vlber p~vlpla p~nltyp p~nlber p~nlpla
INTO TABLE zmseg_del
FROM ltap AS p INNER JOIN makt AS t
ON p~matnr EQ t~matnr
FOR ALL ENTRIES IN goodsmvt_items
WHERE charg = goodsmvt_items-batch
AND t~spras = 'E'
AND vltyp IN ('901', '902').

Please let me know what could be the problem and possible solutions for this.