query 1:
SELECT BSKey,
InKey,
MAX(Weight) AS Weight,
100.*MAX(Weight)/(SELECT score FROM metaScore WHERE field='_FullScore')
FROM EntityMatch
GROUP BY BSKey, InKey
query 2:
SELECT BSKey,
InKey,
MAX(Weight) AS Weight,
100.*MAX(Weight)/score
FROM EntityMatch, metaScore
WHERE field='_FullScore'
GROUP BY BSKey, InKey,score
猜猜结果如何?
query 1:
SQL Server Execution Times:
CPU time = 4578 ms, elapsed time = 16600 ms.
query 2:
SQL Server Execution Times:
CPU time = 2501 ms, elapsed time = 14950 ms.
CPU时间居然要快一倍!
SELECT BSKey,
InKey,
MAX(Weight) AS Weight,
100.*MAX(Weight)/(SELECT score FROM metaScore WHERE field='_FullScore')
FROM EntityMatch
GROUP BY BSKey, InKey
query 2:
SELECT BSKey,
InKey,
MAX(Weight) AS Weight,
100.*MAX(Weight)/score
FROM EntityMatch, metaScore
WHERE field='_FullScore'
GROUP BY BSKey, InKey,score
猜猜结果如何?
query 1:
SQL Server Execution Times:
CPU time = 4578 ms, elapsed time = 16600 ms.
query 2:
SQL Server Execution Times:
CPU time = 2501 ms, elapsed time = 14950 ms.
CPU时间居然要快一倍!