이 항목은 성능 향상에 도움이 되는 보고서 합계에 대한 집계 규칙을 명시적으로 지정하는 방법을 설명하며, 특히 Oracle Analytics를 사용하여 보고서를 작성하는 기술 개발자를 대상으로 합니다.
다음 그림은 보고서 정의가 연도, 월 및 고객 지역이며 측정항목이 Count Distinct of Customers with Orders
(주문이 있는 고객의 고유 수로 정의됨)인 예를 보여줍니다.
논리적 질의는 다음과 같습니다.
SELECT 0 s_0, "A - Sample Sales"."Cust Regions"."C50 Region" s_1, "A - Sample Sales"."Counts"."32 # of Cust with Orders (Cnt Distinct)" s_2, REPORT_AGGREGATE("A - Sample Sales"."Counts"."32 # of Cust with Orders (Cnt Distinct)" BY ) s_3 FROM "A - Sample Sales" WHERE ("Time"."T02 Per Name Month" = '2011 / 11') ORDER BY 2 ASC NULLS LAST FETCH FIRST 500001 ROWS ONLY
생성되는 물리적 질의는 다음과 같습니다.
WITH SAWITH0 AS (select count(distinct T42433.Cust_Key) as c1, T42430.Region as c2 from BISAMPLE.SAMP_CUSTOMERS_D T42428 /* D60 Customers */ , BISAMPLE.SAMP_ADDRESSES_D T42430 /* D62 Customers Addresses */ , BISAMPLE.SAMP_TIME_MTH_D T42405 /* D02 Time Month Grain */ , BISAMPLE.SAMP_REVENUE_F T42433 /* F10 Billed Rev */ where ( T42405.Mth_Key = T42433.Bill_Mth_Key and T42405.Per_Name_Month = '2011 / 11' and T42428.Cust_Key = T42433.Cust_Key and T42428.Address_Key = T42430.Address_Key ) group by T42430.Region), SAWITH1 AS (select count(distinct T42433.Cust_Key) as c1 from BISAMPLE.SAMP_TIME_MTH_D T42405 /* D02 Time Month Grain */ , BISAMPLE.SAMP_REVENUE_F T42433 /* F10 Billed Rev */ where ( T42405.Per_Name_Month = '2011 / 11' and T42405.Mth_Key = T42433.Bill_Mth_Key ) ) select D1.c1 as c1, D1.c2 as c2, D1.c3 as c3, D1.c4 as c4 from ( select D1.c1 as c1, D1.c2 as c2, D1.c3 as c3, D1.c4 as c4 from (select 0 as c1, D1.c2 as c2, D1.c1 as c3, D2.c1 as c4, ROW_NUMBER() OVER (PARTITION BY D1.c2 ORDER BY D1.c2 ASC) as c5 from SAWITH0 D1, SAWITH1 D2 ) D1 where ( D1.c5 = 1 ) order by c2 ) D1 where rownum <= 500001
합계 값 480은 구성 항목 값의 합(182 + 113 + 185)입니다. 합계를 계산하는 논리적 질의 표현식은 “REPORT_AGGREGATE("A - Sample Sales"."Counts"."32 # of Cust with Orders (Cnt Distinct)" BY ) s_3”
입니다.
REPORT_AGGREGATE
가 사용되는 경우 합계는 구성 항목 값과 별개로 계산됩니다. 단, 이 보고서 설계를 위해 이 보고서의 구성 항목으로부터 정확한 합계를 계산할 수 있습니다.
Aggregation Rule (Totals Row)이 Server Complex Aggregate에서 Sum으로 변경되도록 열 공식을 편집할 경우 논리적 및 물리적 SQL 질의가 변경됩니다.
다음 그림은 원래 집계를 보여줍니다.
다음 그림은 수정된 집계를 보여줍니다.
이제 수정된 논리적 SQL 질의에 REPORT_SUM
이 포함됩니다.
SELECT 0 s_0, "A - Sample Sales"."Cust Regions"."C50 Region" s_1,"A - Sample Sales"."Counts"."32 # of Cust with Orders (Cnt Distinct)" s_2, REPORT_SUM("A - Sample Sales"."Counts"."32 # of Cust with Orders (Cnt Distinct)" BY ) s_3 FROM "A - Sample Sales" WHERE ("Time"."T02 Per Name Month" = '2011 / 11') ORDER BY 2 ASC NULLS LAST FETCH FIRST 500001 ROWS ONLY
생성되는 물리적 질의는 다음과 같습니다.
WITH SAWITH0 AS (select count(distinct T42433.Cust_Key) as c1, T42430.Region as c2 from BISAMPLE.SAMP_CUSTOMERS_D T42428 /* D60 Customers */ , BISAMPLE.SAMP_ADDRESSES_D T42430 /* D62 Customers Addresses */ , BISAMPLE.SAMP_TIME_MTH_D T42405 /* D02 Time Month Grain */ , BISAMPLE.SAMP_REVENUE_F T42433 /* F10 Billed Rev */ where ( T42405.Mth_Key = T42433.Bill_Mth_Key and T42405.Per_Name_Month = '2011 / 11' and T42428.Cust_Key = T42433.Cust_Key and T42428.Address_Key = T42430.Address_Key ) group by T42430.Region), SAWITH1 AS (select 0 as c1, D1.c2 as c2, D1.c1 as c3 from SAWITH0 D1) select D1.c1 as c1, D1.c2 as c2, D1.c3 as c3, D1.c4 as c4 from ( select D1.c1 as c1, D1.c2 as c2, D1.c3 as c3, sum(D1.c3) over () as c4 from SAWITH1 D1 order by c2 ) D1 where rownum <= 500001
동일한 명시적 집계 설정 옵션을 워크북에서도 사용할 수 있습니다. 시각화의 숫자 값 형식 지정을(를) 참조하십시오. 이 예제에서 Count Distinct Customers with Orders 열의 경우 집계 방법을 합계로 변경합니다.
보고서를 검토하여 보고서에 최적의 집계 규칙이 사용되고 있는지 확인합니다. 보고서 설계에서 허용하는 경우 명시적 집계 규칙을 사용합니다.
보고서에 대한 자세한 내용은 분석 생성을(를) 참조하십시오