임시 테이블이 필요한 일부 sprocs가 있습니다. 컬럼 테이블 (어떤 길이의 varchar)을 하드 코딩하지 않기 위해 참조 테이블 스키마가 변경되면 (즉 필드가 길어질 때) 선언을 변경하지 않아도됩니다 (테이블 호출 생성 대신). 이에 실행 계획을 수행 할 때 어디에서 1 = 2가 모든 행에 대해 호출 되나요?
select orderId
into #sometmptbl
from orders
where 1=2
그러나, 실제로는 테이블/인덱스에 갈 것 같다 : 성명 1
쿼리 계획 (라인 1에서). 632082.
이 평균 1 = 2가 인덱스의 모든 항목에 대해 평가됩니다 않습니다
STEP 1
The type of query is CREATE TABLE.
STEP 2
The type of query is INSERT.
The update mode is direct.
FROM TABLE
orders
Nested iteration.
Index : orders_idx1
Forward scan.
Positioning at index start.
Index contains all needed columns. Base table will not be read.
Using I/O Size 2 Kbytes for index leaf pages.
With LRU Buffer Replacement Strategy for index leaf pages.
TO TABLE
#sometmptbl
Using I/O Size 2 Kbytes for data pages.
총
는 (1 호선에서) 문 1 I/O 비용을 추정? 일정 시간에이 작업을 수행 할 수있는 방법이 있습니까?Table: orders scan count 0, logical reads: (regular=0 apf=0 total=0), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
Table: #sometmptbl_____00002860018595346 scan count 0, logical reads: (regular=1 apf=0 total=1), physical reads: (regular=0 apf=0 total=0), apf IOs used=0
Total actual I/O cost for this command: 2.
Total writes for this command: 3
0 row(s) affected.
당신 말이 맞아요. 실제 읽기는 0입니다. – naumcho