查询DISTINCT性能问题???
flers 2004-09-08 04:01:57 select distinct flight_date,
airways2code,
TBLB.Dep,
TBLB.dest,
awb_prefix + awb_no as awb,
flight_dep,
flight_dest,
TBLA.Weight as Cweight,
Piece,
Cargo_Block_ID,
TBLA.Commodity_Name,
TBLA.flight_no,
TBLD.ac_type,
TBLB.Freight,
TBLA.agent_id,
TBLB.weight as Aweight,
(TBLA.Weight / TBLB.weight) * TBLB.Freight as 航空运费,
company_SName
from tbl_cargobill as TBLA
left join (select awb_prefix + awb_no as awb,
Freight,
weight,
dep,
dest
from tbl_awb_basic) as TBLB
on TBLB.AWB = awb_prefix + awb_no
left join (select TBL_FLIGHT_ACTIVE.flight_no,
TBL_FLIGHT_ACTIVE.ac_type
from TBL_FLIGHT_ACTIVE) AS TBLD
ON TBLA.flight_no = TBLD.flight_no
left join (select agent_id,
company_SName
from tbl_agent TBLC) TBLC
on TBLA.agent_id = TBLC.agent_id
where (TBLA.flight_no is not null)
AND (flight_date between '2004-8-30' and '2004-8-30')
把distinct 去了要3秒,每个表7万条记录,但加上的话至少要6-8秒,而且distinct花的资源是85%有什么办法提高呢?