use-the-index-luke 저자 Markus Winand
Markus Winand는 SQL에 대한 통찰력을 제공하고 다양한 시스템이 SQL을 지원하는 방법을 modern-sql.com 에서 보여줍니다. 이전에 그는 use-the-index-luke.com 을 만들었는데, 지금도 활발하게 유지되고 있습니다. Markus는 winand.at 를 통해 강사, 연사 및 컨설턴트로 고용될 수 있습니다.
You can upload a Korean translation of use-the-index-luke.com on your blog
Thank you from the bottom of my heart to author Makus Winand for allowing me.
These are translations that I use for studying by using a papago (google translate)
The translations may not be correct or there may be a typo.
I'd appreciate it if you could point it out in the comments.
use-the-index-luke.com 의 한글번역본을 블로그에 업로드 해도 된다고
허락해주신 Makus Winand 저자님께 진심으로 감사합니다.
이 번역본들은 제가 공부용도로 번역기(papago, google transrate)를 돌려서
번역한 내용들이라 맞지 않거나, 오타가 있을수 있습니다.
댓글로 지적해주시면 감사하겠습니다.
https://use-the-index-luke.com/sql/explain-plan/sql-server/filter-predicates
ㄴaccess 및 filter prdicate 구분
SQL Server 데이터베이스는 where 절 (predicates)을 적용하기 위해 세 가지 방법을 사용합니다:
Access Predicate ("Seek Predicates")
access predicates 는 leaf node traversal의 시작 및 중지 조건을 나타냅니다.
Index Filter Predicate ("Predicates" or "where" for index operations)
Index filter predicates 는 leaf node traversal 중에만 적용됩니다. 시작 및 중지 조건에 영향을 주지 않으며 스캔 범위를 좁히지 않습니다.
Table level filter predicate ("where" for table operations)
인덱스의 일부가 아닌 열에 대한 Predicates 은 테이블 수준에서 평가됩니다. 이렇게 하려면 데이터베이스가 먼저 힙 테이블에서 행을 로드해야 합니다.
다음 섹션에서는 SQL Server 실행 계획에서 filter predicates를 식별하는 방법을 설명합니다.
3장에서 demonstrate the impact of index filter predicates에 사용된 샘플을 기반으로 합니다. 부록에는 표를 채우기 위한 전체 스크립트가 있습니다.
CREATE TABLE scale_data ( section NUMERIC NOT NULL, id1 NUMERIC NOT NULL, id2 NUMERIC NOT NULL )
CREATE INDEX scale_slow ON scale_data(section, id1, id2)
샘플 문은 SECTION 및 ID2를 기준으로 선택합니다:
SELECT count(*) FROM scale_dataWHERE section = @sec AND id2 = @id2
In Graphical Execution Plans
그래픽 실행 계획은 Index Seek 작업 위로 마우스를 이동할 때만 표시되는 도구 설명에 predicate information 를 숨깁니다. Index Seek 아이콘 위에 마우스를 올려 놓으면 이 웹 페이지에서 predicate information를 볼 수 있습니다.
SQL Server's Seek Predicates은 Oracle의 access predicates에 해당하므로 leaf node traversal을 좁힙니다. SQL Server의 그래픽 실행 계획에서 Filter predicates에는 술어라는 레이블만 지정됩니다.
In Tabular Execution Plans
표 형식의 실행 계획에는 작업이 표시되는 열과 동일한 열에 predicate information 가 있습니다. 따라서 모든 관련 정보를 한 번에 복사하고 통과하는 것이 매우 쉽습니다.
DECLARE @sec numeric
DECLARE @id2 numeric
SET STATISTICS PROFILE ON
SELECT count(*) FROM scale_dataWHERE section = @sec AND id2 = @id2
SET STATISTICS PROFILE OFF
실행 계획이 결과 창에 두 번째 결과 세트로 표시됩니다. 다음은 StmtText 열입니다. 읽기 쉽도록 약간 다시 포맷합니다:
|--Compute Scalar(DEFINE:([Expr1004]=CONVERT_IMPLICIT(...)) |--Stream Aggregate(DEFINE:([Expr1008]=Count(*))) |--Index Seek(OBJECT:([scale_data].[scale_slow]), SEEK: ([scale_data].[section]=[@sec]) ORDERED FORWARD WHERE:([scale_data].[id2]=[@id2]))
SEEK 라벨에는 access predicates, WHERE 라벨에는 filter predicates가 표시됩니다.
Tip
- [ ] “Greater, Less andBETWEEN”섹션에서는 액세스 및 인덱스 필터 술어의 차이를 예로 들어 설명합니다.
- [ ] Chapter3, “Performance and Scalability”에서는 필터 술어가 수행하는 성능 차이를 보여줍니다.
'use-the-index-luke' 카테고리의 다른 글
A.6-1 (SQLite) Getting (0) | 2024.01.22 |
---|---|
6.SQLite (0) | 2024.01.18 |
A.5-2 (SQL Server) Operations (1) | 2024.01.11 |
A.5-1 (SQL Server) Getting (1) | 2024.01.08 |
A.5 SQL Server (0) | 2024.01.05 |