Skip to content

Commit

Permalink
applying code review
Browse files Browse the repository at this point in the history
  • Loading branch information
xmilex-git committed Aug 7, 2024
1 parent 0c57ec6 commit 9cb1bfb
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 9 deletions.
16 changes: 12 additions & 4 deletions en/sql/tuning.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4216,7 +4216,9 @@ If no cached value is found, the subquery is executed and its results, along wit
If the same column values are found in the cache, the results are retrieved from the cached area.

The following example measures the performance difference depending on whether the subquery cache is used or not.
First, a query to prepare the data for measuring performance differences is written: ::
First, a query to prepare the data for measuring performance differences is written:

::
# Prepare data
csql> DROP TABLE IF EXISTS t1;
Expand Down Expand Up @@ -4280,7 +4282,9 @@ The results of the first example might be slow as the cache is not activated usi

When SQL trace is queried, trace information about the subquery cache for the relevant subquery is displayed.

The following example displays trace information for the subquery cache in a case where the subquery cache is enabled: ::
The following example displays trace information for the subquery cache in a case where the subquery cache is enabled:

::

csql> SELECT COUNT(*)
FROM (
Expand Down Expand Up @@ -4324,7 +4328,9 @@ Additionally, if the ratio of **miss** to **hit** is higher than 9, even if the
Subquery cache is disabled if the correlated subquery contains another correlated subquery.
However, if the included correlated subquery does not contain another correlated subquery, it is enabled.

The following example shows a case where a correlated subquery contains another correlated subquery: ::
The following example shows a case where a correlated subquery contains another correlated subquery:

::

csql> SELECT /*+ recompile */
(
Expand Down Expand Up @@ -4353,7 +4359,9 @@ The following example shows a case where a correlated subquery contains another

Moreover, subquery cache is disabled in a correlated subquery that includes functions like random (), sys_guid () that produce different results each time they are executed.

The following example shows a case where a correlated subquery includes random (): ::
The following example shows a case where a correlated subquery includes random ():

::

csql> WITH cte_1 AS
(SELECT
Expand Down
21 changes: 16 additions & 5 deletions ko/sql/tuning.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4218,7 +4218,9 @@ Predicate Push
같은 컬럼 값이 캐시에서 발견되면 캐시된 영역에서 결과를 가져온다.

다음은 서브 쿼리 캐시의 사용 유무에 따른 성능 차이를 측정하는 예제이다.
먼저 성능 차이를 측정하기 위해 데이터를 준비하는 쿼리를 작성한다. ::
먼저 성능 차이를 측정하기 위해 데이터를 준비하는 쿼리를 작성한다.

::
# Prepare data
csql> DROP TABLE IF EXISTS t1;
Expand Down Expand Up @@ -4249,7 +4251,9 @@ Predicate Push
csql> ;trace on

CSQL에서는 아래 예제와 같이 COUNT 함수를 사용하여 질의를 반복적으로 실행할 때 개선된 성능을 쉽게 측정할 수 있다.
첫 번째 부질의에 대한 결과는 **NO_SUBQUERY_CACHE** 힌트를 사용하여 캐시가 활성화되지 않아 느릴 수 있지만, 두 번째부터는 캐시된 영역에서 가져오므로 응답 시간이 훨씬 빠르다. ::
첫 번째 부질의에 대한 결과는 **NO_SUBQUERY_CACHE** 힌트를 사용하여 캐시가 활성화되지 않아 느릴 수 있지만, 두 번째부터는 캐시된 영역에서 가져오므로 응답 시간이 훨씬 빠르다.

::

# Target query #1
csql> SELECT COUNT(*)
Expand Down Expand Up @@ -4282,7 +4286,9 @@ CSQL에서는 아래 예제와 같이 COUNT 함수를 사용하여 질의를 반

또한 SQL 트레이스를 조회하는 경우, 해당하는 부질의의 하위 정보로 서브 쿼리 캐시에 대한 트레이스 정보가 출력된다.

다음 예시는 서브 쿼리 캐시가 활성화된 경우 해당하는 부질의의 하위 정보로 서브 쿼리 캐시에 대한 트레이스 정보가 출력되는 예시이다. ::
다음 예시는 서브 쿼리 캐시가 활성화된 경우 해당하는 부질의의 하위 정보로 서브 쿼리 캐시에 대한 트레이스 정보가 출력되는 예시이다.

::

# Target query #2
csql> SELECT COUNT(*)
Expand Down Expand Up @@ -4325,7 +4331,9 @@ CSQL에서는 아래 예제와 같이 COUNT 함수를 사용하여 질의를 반

서브 쿼리 캐시는 상관 부질의 안에 상관 부질의가 있는 경우 비활성화된다. 하지만 포함된 상관 부질의 내부에 상관 부질의가 없는 경우에는 활성화된다.

다음 예시는 상관 부질의가 상관 부질의를 포함한 경우의 예시이다. ::
다음 예시는 상관 부질의가 상관 부질의를 포함한 경우의 예시이다.

::
csql> SELECT /*+ recompile */
(
Expand Down Expand Up @@ -4353,7 +4361,10 @@ CSQL에서는 아래 예제와 같이 COUNT 함수를 사용하여 질의를 반
SUBQUERY_CACHE (hit: 99, miss: 1, size: 150704, status: enabled)

또한 서브 쿼리 캐시는 상관 부질의에 random (), sys_guid ()와 같이 실행될 때마다 결과가 바뀌는 함수가 포함된 경우 비활성화된다.
다음 예시는 상관 부질의에 random ()을 포함한 경우의 예시이다. ::

다음 예시는 상관 부질의에 random ()을 포함한 경우의 예시이다.

::

csql> WITH cte_1 AS
(SELECT
Expand Down

0 comments on commit 9cb1bfb

Please sign in to comment.