סה"כים לדוח

מידע זה מתאר דרכים להקצות באופן מפורש את כלל הסכימה לסה"כים של דוח, מה שמשפר ביצועים, והוא נועד באופן ספציפי למפתחים טכניים שכותבים דוחות באמצעות Oracle Analytics.

בדוגמה זו, הגדרת הדוח היא שנה, חודש ואזור של לקוח, עם המדד 'Count Distinct of Customers with Orders', המוגדר כספירת נבדלים של לקוחות עם הזמנות.

להלן תיאור של GUID-4E9DB43C-F827-4BBB-A94D-5A91F3626C72-default.jpg
.jpg

הנה השאילתא הלוגית:

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 הלוגית והפיזית.

סכימה מקורית:

להלן תיאור של GUID-96FB697B-24F7-41A9-8678-F99921E5BB19-default.jpg
.jpg

סכימה מתוקנת:

להלן תיאור של GUID-ED289D12-C0BD-4588-B288-2069EAB3EB1D-default.jpg
.jpg

ל-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

אותה האפשרות להגדיר באופן מפורש את הסכימה, זמינה בחוברות עבודה:

להלן תיאור של GUID-DAE63F66-EF2A-45B0-8657-38301F4DC77E-default.jpg
.jpg

בדוק את הדוחות שלך כדי לראות שנעשה שימוש בכלל הסכימה הטוב ביותר בדוח. השתמש בכלל סכימה מפורש כאשר עיצוב הדוח מתיר זאת.

לקבלת מידע נוסף על דוחות, ראה יצירת ניתוחים.