比较了两条 MySQL 命令,差异巨大。看来要小心 IN 子句!
SELECT DISTINCT a.FamilyID,a.GenusID,a.SPID,a.FamilyName,a.CFamilyName,a.GenusName,a.CGenusName,a.LName,a.CName
From IDents a,(select DISTINCT SPID from Photo Where FolderID='5bbb2ae0-a747-4f3c-afce-3ed39f784f56' AND LName!='') AS b
Where a.SPID=b.SPID
执行时间 0.0132s
SELECT DISTINCT a.FamilyID,a.GenusID,a.SPID,a.FamilyName,a.CFamilyName,a.GenusName,a.CGenusName,a.LName,a.CName
From IDents a
Where a.SPID IN
(select DISTINCT SPID from Photo Where FolderID='5bbb2ae0-a747-4f3c-afce-3ed39f784f56' AND LName!='')
执行时间 76.1623s