SELECT
CountryCode, CountryName, CountryEName, FirstShow, iseTicketFirstShow
FROM
Tristar.dbo.COMCountry
WHERE
ContinentName = 'Continent Name' AND iseTicket = 1
and CountryCode in
(select Distinct CountryCode
from eTicketSubAirport
where AirportCode in
(select DISTINCT eTDestinationAirport
from eTicketMain
where eTChecked=1 and eTDepartAirport='TPE')
)
ORDER BY
iseTicketFirstShow DESC, FirstShow,CountryEName
上記のコードは 3 秒かかりました....これは受け入れられません。2 つの内部選択は、単独で非常に高速に実行されます。
で、インナーセレクトを一つ外すと…。
SELECT
CountryCode, CountryName, CountryEName, FirstShow, iseTicketFirstShow
FROM
Tristar.dbo.COMCountry
WHERE
ContinentName = 'continent name' AND iseTicket = 1
and CountryCode in
(select Distinct CountryCode
from eTicketSubAirport)
ORDER BY
iseTicketFirstShow DESC, FirstShow,CountryEName
これも非常に高速に実行されます。
ハッシュマッチも処理の79%。[eTicketサブエアポート]
それらはすべて必要なので、選択の一部を取り出すことはできません....