동일한 결과를 출력하는 두 개의 쿼리가 있습니다. 나는 둘의 성능에 차이가 있고 어떤 것이 더 사용하기 좋은지 알고 싶습니다. 그 중 하나가 다른 것보다 낫다는 이유에 대한 설명을 주거나, 왜 같은 이유인지 설명해주십시오.두 쿼리 간의 SQL 성능
Query2는 Query1보다 12ms 빠르지 만 임의의 서버 지연이 발생할 수 있습니다. 예를 들어 다시 실행하면 각기 다른 시간이됩니다.
쿼리 1 : 시간 66ms
select
*
from
table1,
table2,
table3,
table4,
table5,
table6,
table7
where
table1.type1 = 402 and
table1.pid = table2.pid and
table1.aid = table3.aid and
table1.tid = table4.tid and
table4.type2 = table5.code and
table1.status = table6.code2 and
table7.eaid = table1.caid
질의 2 : 시간 - 54ms
select
*
from
table1
join table2 on table2.pid= table1.pid
join table3 on table1.aid = table3.aid
join table4 on table1.tid = table4.tid
join table5 on table4.type2= table5.code
join table6 on table1.status= table6.code2
join table7 on table7.eaid= table1.caid
where
table1.type1 = 402
질문에 실제 쿼리 계획을 추가하십시오. –
여기 http://programmers.stackexchange.com/questions/78225/using-join-keyword-or-not – jayvee
그들은 동일한 쿼리처럼 보이지만 쿼리 2는 ANSI와 호환됩니다. –