-1
SELECT
DISTINCT t0.ID,
t0.CODE_MEANING,
t0.CODE_SCHEME_DESIGNATOR,
t0.CODE_SCHEME_VERSION,
t0.CODE_VALUE,
t0.MODALITY,
t0.NAME,
t0.OBSOLETE,
t0.FACILITY_KEY
FROM PROTOCOL t0
WHERE EXISTS (
SELECT 1
FROM CT_STUDY t2, STUDY t1
WHERE t1.STUDY_DATE <= '2017-09-19 01:23:25.86'
AND t2.ID = t1.ID
AND t1.DTYPE = 'CTStudy'
AND t0.ID = t2.PROTOCOL_KEY
)
AND NOT EXISTS (
SELECT 1
FROM CT_STUDY t5, STUDY t4
WHERE t5.PROTOCOL_KEY = t0.ID
AND t4.STUDY_DATE > '2017-09-19 01:23:25.86'
AND t5.ID = t4.ID
AND t4.DTYPE = 'CTStudy'
)
AND t0.FACILITY_KEY = 1;
색인은 어떻습니까? EXPLAIN의 출력을 게시 할 수 있습니까? – Harry
아래의 설명 플랜을 찾으십시오. – Abi
| 이드 | select_type | 테이블 | 유형 | possible_keys | 열쇠 | key_len | 심판 | 행 | 추가 – Abi