这是查询
SELECT cs_checkroll_txn_id,ad_division_id,ad_fld_info_id,transaction_date,mandays,man_day_type,ot_hours,ot_type,norm, qty, over_qty, lent_devision,lent_field_no,block_no, latex_ltr, drc,latex_kg,scarp, condition, noofbushes, wt_bunch,harvest_round,w.work_code work_code,w.work_category work_category,w.unit_of_measure unit_of_measure,w.isnorm,r.type,r.rate_code rate_code,reguler_norm, regular_over,reguler_extra, sunday_norm, sunday_over,sunday_extra, holiday_norm, holiday_over,holiday_extra, special_day_norm,special_day_extra, unit, special_day_over
FROM adempiere.cs_checkroll_txn t,adempiere.cs_work_code w,adempiere.ad_checkroll_rates r
WHERE t.cs_work_code_id = w.cs_work_code_id
AND w.ad_checkroll_rates_id = r.ad_checkroll_rates_id
AND iscontract <> 'Y'
AND t.isactive = 'Y'
AND w.isactive = 'Y'
AND r.isactive = 'Y'
AND t.cs_worker_cont_id = 1005312
AND t.ad_client_id = 1000002
AND t.ad_org_id = 1000042
AND t.transaction_date between to_date('20130401','yyyymmdd')
AND to_date('20130930','yyyymmdd')
答案 0 :(得分:0)
一般规则是为您必须执行频繁搜索或排序的所有列创建索引。在你的情况下,这是:
t.cs_work_code_id
w.cs_work_code_id
w.ad_checkroll_rates_id
r.ad_checkroll_rates_id
iscontract
t.isactive
w.isactive
r.isactive
t.cs_worker_cont_id
t.ad_client_id
t.ad_org_id
t.transaction_date
答案 1 :(得分:0)
我可以建立一个包含字段ad_org_id,ad_client_id,cs_worker_cont_id的索引。假设他们的订单是熵。