我必须快速访问包含唯一索引 mstr_nbr 的大数据的数据库,我怎样才能让它快速。其中获取第一个 mstr 花费 0ms 并获取下一个 mstr 花费大部分时间 0ms 但有时需要 1ms 意味着每个 mstr 运行 180000 12000 运行需要 1 ms 这正在增加时间,如果没有串行循环每次增加 12000ms 秒也增加这是一个webspeed生成的网页我怎样才能让它快速......任何人帮助
DEFINE QUERY Mstr FOR mstr scrolling.
OPEN QUERY Mstr FOR EACH mstr no-lock
where (Mstr_status = "close" or Mstr_status = "closed").
FOR EACH serial
WHERE (serial_pallet = f_pallet AND serial_f_chr11 <> "BOX")
or (serial_key begins f_pallet)
NO-LOCK BREAK BY serial_pallet by serial_parent by serial__chr11 QUERY-TUNING(LOOKAHEAD CACHE-SIZE 32768 DEBUG EXTENDED):
GET FIRST Mstr.
define variable roID as rowid no-undo.
roID = rowid(mstr).
DO WHILE NOT QUERY-OFF-END('Mstr'):
for each det fields(detnbr detmodel detlot detqty) no-lock
where (detnbr = mstr_nbr) and (detmodel = serial_parent and detlot = serial__chr11):
tinspected = tinspected + detqty.
end. /* for each */
GET NEXT Mstr.
END.
reposition mstr to rowid roID.
end.
mstr 表的索引
index-name field-name
badgenew 1 badgenew Active
datenew 1 datenew Active
nbridx 1 nbr Unique Primary Active
pallet 1 pallet Active
proddesc 1 proddesc Active
prodline 1 prodline Active
status 1 status Active
type 1 type Active
表序列的索引:
actual_prod_day 1 dte04 2 serial_chr01 Active
actual_prod_line 1 serial_pallet 2 serial_dte04 3 serial_chr01 4 serial_line Active
pallet_prod 1 serial_pallet 2 serial_dte04 Active
pallet_prod_line 1 serial_pallet 2 serial_dte04 3 serial_line Active
serial_chr01 1 serial_chr01 Active
serial_chr05 1 serial_chr05 Active
serial_chr06 1 serial_chr06 Active
serial_chr11 1 serial_chr11 Active
serial_chr14 1 serial_chr14 Active
serial_dte04 1 serial_dte04 Active
serial_int01 1 serial_int01 Active
serial_line 1 serial_line Active
serial_pallet 1 serial_pallet Active
serial_parent 1 serial_parent Active
serial_serial__key 1 serial_serial__key 2 serial_parent Unique Primary Active
serial_pallet serial_key 和 serial_c11 都是字符数据类型
表 det 的索引:
detidx 1 detnbr 2 detpallet 3 detprodline 4 detbox 5 detlot 6 detshift Unique Primary Active
detlot 1 detlot Active
detmodel 1 detmodel Active
detnbr 1 detnbr Active
detpallet 1 detpallet Active
detprodline 1 detprodline Active