메뉴 건너뛰기

SAP 한국 커뮤니티

[re] inner join 과 sub query 의 퍼포먼스...

Risky 2009.09.12 03:35 조회 수 : 60026

1. Subquery


1) A subquery is contained within a SELECT, UPDATE or DELETE statement. A subquery is formulated in the WHERE or HAVING clause, to check whether data from various datatbase tables or views fulfills certain conditions.


2) A SELECT statement with a subquery has a more restricted syntax than a SELECT statement without a subquery: SELECT ...FROM dbtab [WHERE...]  [GROUP BY...] [HAVING...]. If the subquery returns one value, standard relational operators can be used, with the exception of LIKE and BETWEEN.


3) If a subquery is used with a relational operator rather than with EXISTS, only one column can be specified in the SELECT clause of the subquery . This can be a field the database table, or an aggregate expersssion.


4) In the example above, the goal is for the subquery to return several rows with one value each. If you want to compare all values returned,use In.


5) Subquery in which fields from the main query are used in the WHERE clause are called correlated subqueries. If several subqueries are nested, a subquery can use all fields from the subqueries above it in the hierarchy.


6) Always use positive formulations for subqueries if possible, Negative formulations can cause unperformant accesses to the database if there is no suitable index.


 


2. INNER JOIN


1) In an ABAP Join, database tables are joined using the ON clause. You can use aliases for the relevant tables, as shown in the example above. You can also specify field lists (projection) and Where clause (selection) for ABAP joins.


2) Ensure that you clearly allocate the field name in the SELECT clause, in the ON clause, and in the Where clause to a table or to an alias for a table. If the database does not support Standard SQL, the ON conditions are converted to Where conditions.


3) ABAP JOINs also bypass the SAP table buffering. To implement a JOIN on a buffered table, it may be best to define a buffered datatbase view on the table.


4) If you use parentheses, an ABAP JOIN can link more than two tables.Do not join too many tables, because this increases the complexity of processing the SQL statement on the database.


5) In the example above, an INNER JOIN is implemented. Therefore, the resulting set(with a blue frame) contains only the data records with entries for field KUNNR
in both VVBAK and KKNA1.

번호 제목 글쓴이 날짜 조회 수
47 <img src=3.gif>숫자 세자리마다 콤마 붙여주는 펑션이 있나요 [7] 아밥맨 2009.10.03 9280
46 [요청]at first, at last, at new, at end 정확한 개념좀 갈켜주세여.. 휴... [5] 아밥입문자 2008.08.25 9310
45 <img src=2.gif>ALV 셀 병합하는 방법 알려주세요.. [4] 은미짱 2011.03.23 9443
44 [요청]alv에서 edit_mask 사용하구싶은데 잘안되네요.. [2] CoolGuy 2008.09.10 9464
43 [요청]SE80에서 프로그램 옆의 Description에 관하여 문의드립니다. [5] 풍뎅이 2008.02.27 9563
42 <b>[완료]</b>Gui->WEB 호출시 파라미터 문제 [2] 윤군친구(bsp개발자) 2007.12.08 9575
41 [요청] 변경된 내용이 없는데도 CHECK_CHANGED_DATA 메소드가 'X'을 내어서 계속 팝업메시지가 뜹니다. [3] 하오 2008.07.03 9644
40 <b>[완료]</b>cursor 프로그램 관련 질문입니다. [4] order001 2007.12.05 9790
39 [요청]ALV 에서 수량 필드 소숫점 없애는 방법 [5] 파릇이 2008.06.12 9979
38 <b>[완료]</b>오라클의 CASE WHEN과 같은 기능.. [8] 풍뎅이 2007.12.06 10234
37 [요청]GETWA_NOT_ASSIGNED 이 오류에 대해서 아시는 분? [7] 나도아밥퍼 2008.01.08 10343
36 [요청]인터널테이블 끼리 move-corresponding 안될까요~~ [5] genius 2008.03.14 10552
35 <b>[완료]</b>"DESCRIBE TABLE ~~~ LINES " 관련 질문입니다. [2] tenyearsago 2009.01.05 10694
34 [질문] alv에서 필드 폭의 길이를 지정할 수 없나요? [5] 나도아밥퍼 2007.05.23 10717
33 <b>[완료]</b>sy-index와 sy-tabix의 차이가 궁금합니다. [7] kkk 2008.02.27 10961
32 <b>[완료]</b>call transaction 사용하는 방법 좀 가르쳐주세요. [8] 행복한외계인 2007.11.22 11194
31 <b>[완료]</b>Internal table을 만든 table로 데이터를 옮기려고 하는데 잘 안되네요. [10] 행복한외계인 2008.01.22 11424
30 [요청]Modify 와 Modify Table 의 차이좀 알고싶어요~ [4] 아밥걸 2008.07.10 11449
29 <b>[완료]</b>관계연산자의 의미를 알고싶습니다. [3] 다급 2008.06.30 11539
28 <b>[완료]</b>라디오 버튼 입고구분 어떻게 해야하나요? [4] hogun 2008.02.29 12346