Berichtssummen

Hier werden Methoden beschrieben, wie Sie die Aggregationsregel für Berichtssummen explizit zuweisen können, um die Performance zu verbessern. Das ist speziell für technische Entwickler gedacht, die Berichte mit Oracle Analytics schreiben.

In diesem Beispiel ist der Bericht für Jahr, Monat und Kundenregion definiert, mit der Metrik 'Count Distinct of Customers with Orders' (Anzahl eindeutige Kunden mit Bestellungen).

Beschreibung von GUID-4E9DB43C-F827-4BBB-A94D-5A91F3626C72-default.jpg folgt
.jpg

So sieht die logische Abfrage aus:

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

Die folgende physische Abfrage wird generiert:

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

Der Gesamtwert 480 ist die Summe der Werte der einzelnen Bestandteile: 182 + 113 + 185. Die Summe wird mit dem folgenden logischen Abfrageausdruck berechnet: "REPORT_AGGREGATE("A - Sample Sales"."Counts"."32 # of Cust with Orders (Cnt Distinct)" BY ) s_3".

Wenn Sie "REPORT_AGGREGATE" verwenden, wird die Summe unabhängig von den Werten der einzelnen Bestandteile berechnet. Für dieses Berichtsdesign haben wir aber festgelegt, dass die korrekte Summe aus den einzelnen Bestandteilen für diesen Bericht berechnet werden kann.

Bearbeiten Sie die Spaltenformel, um Aggregationsregel (Summenzeile) von Serverkomplexaggregat in Summe zu ändern. Dadurch werden die logische und die physische SQL geändert.

Ursprüngliche Aggregation:

Beschreibung von GUID-96FB697B-24F7-41A9-8678-F99921E5BB19-default.jpg folgt
.jpg

Geänderte Aggregation:

Beschreibung von GUID-ED289D12-C0BD-4588-B288-2069EAB3EB1D-default.jpg folgt
.jpg

Die geänderte logische SQL enthält jetzt "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

Die folgende physische Abfrage wird generiert:

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

Die gleiche Option zum expliziten Festlegen der Aggregation ist in Arbeitsmappen verfügbar:

Beschreibung von GUID-DAE63F66-EF2A-45B0-8657-38301F4DC77E-default.jpg folgt
.jpg

Prüfen Sie, ob die beste Aggregationsregel für Ihre Berichte verwendet wird. Verwenden Sie eine explizite Aggregationsregeln, wenn das Berichtsdesign das zulässt.

Weitere Informationen zu Berichten finden Sie unter Analysen erstellen.