作者lkerr (kerr)
看板Database
标题[SQL ] MySQL Join 没有用上Index
时间Tue Aug 25 11:58:20 2009
现在有两个Tables, A 及 B
A
--------
OID INT
IID INT
DSC VARCHAR2(255)
B
--------
RID INT
IID INT
DA VARCHAR2(10)
A.IID 及 B.IID 有 Index
explain select * from A,B where A.IID = B.IID
id * select_type * table type possible_keys key key_len ref rows Extra *
1 SIMPLE A ALL IID_IDX 6
1 SIMPLE B ALL IID_IDX 4 Using where; Using join buffer
为什麽Join用不上Index??
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 202.175.73.90
1F:推 PsMonkey:所以,你要说的是? 08/25 12:10
※ 编辑: lkerr 来自: 202.175.73.90 (08/25 12:22)
2F:→ KC73:explain select * from A,B where A.IID = B.IID\G 比较好读 08/26 02:05
3F:→ fphoenix923:因为两个Table都是Full Table Scan,没必要用 08/27 20:40