נושא זה מתאר דרכים להקצות באופן מפורש את כלל הסכימה לסה"כים של דוח, מה שמשפר ביצועים, והוא נועד באופן ספציפי למפתחים טכניים שכותבים דוחות באמצעות 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 הלוגית והפיזית שונתה.
האיור הבא ממחיש את הסכימה המקורית.
האיור הבא ממחיש את הסכימה ששונתה.
לשאילתת ה-logical 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
אותה האפשרות להגדיר באופן מפורש את הסכימה, זמינה בחוברות עבודה. ראה עיצוב ערכים מספריים של המחשות גרפיות. לדוגמה זו, בשביל העמודה 'ספירה לקוחות נבדלים' עם הזמנות, שנה את שיטת הסכימה לסכום.
בדוק את הדוחות שלך כדי לראות שנעשה שימוש בכלל הסכימה הטוב ביותר בדוח. השתמש בכלל סכימה מפורש כאשר עיצוב הדוח מתיר זאת.
לקבלת מידע נוסף על דוחות, ראה צור ניתוחים.