Home >php教程 >php手册 >MySQL手册版本 5.0.20-MySQL优化(二) (1)(4)

MySQL手册版本 5.0.20-MySQL优化(二) (1)(4)

WBOY
WBOYOriginal
2016-06-13 10:06:50990browse



下面的例子展示了如何通过 EXPLAIN 提供的信息来较大程度地优化多表联合查询的性能。


假设有下面的 SELECT 语句,正打算用 EXPLAIN 来检测:


EXPLAIN SELECT tt.TicketNumber, tt.TimeIn,

tt.ProjectReference, tt.EstimatedShipDate,

tt.ActualShipDate, tt.ClientID,

tt.ServiceCodes, tt.RepetitiveID,

tt.CurrentProcess, tt.CurrentDPPerson,

tt.RecordVolume, tt.DPPrinted, et.COUNTRY,

et_1.COUNTRY, do.CUSTNAME

FROM tt, et, et AS et_1, do

WHERE tt.SubmitTime IS NULL

AND tt.ActualPC = et.EMPLOYID

AND tt.AssignedPC = et_1.EMPLOYID

AND tt.ClientID = do.CUSTNMBR;

在这个例子中,先做以下假设:


要比较的字段定义如下:

(t114)

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn