1024.6, не знал, куда поместить, пишу здесь, ибо СМ
Итак, проблема - заказ поставщикам по одному контракту выполняется по одному из поставщиков около 15 минут по всем МХ (49). Не устроило.
Решение:
Код:
CREATE MATERIALIZED VIEW LOG ON
"SUPERMAG"."SMSPEC"
TABLESPACE INDX NOLOGGING
WITH ROWID,SEQUENCE("DOCTYPE","DOCID","ARTICLE")
INCLUDING NEW VALUES;
CREATE MATERIALIZED VIEW LOG ON
"SUPERMAG"."SMDOCUMENTS"
TABLESPACE INDX NOLOGGING
WITH ROWID,SEQUENCE("DOCTYPE","ID","DOCSTATE","CLIENTINDEX")
INCLUDING NEW VALUES;
CREATE MATERIALIZED VIEW LOG ON
"SUPERMAG"."SMDATEDOCS"
TABLESPACE INDX NOLOGGING
WITH ROWID,SEQUENCE("ID","DOCTYPE","DATEDAT")
INCLUDING NEW VALUES;
CREATE MATERIALIZED VIEW"SUPERMAG"."MV_FOR_ORDERS"
TABLESPACE INDX NOLOGGING
REFRESH FORCE
START WITH to_date('01-31-2009 10:48:20','MM-dd-yyyy hh24:mi:ss') NEXT sysdate+30/1440
ENABLE QUERY REWRITE
AS SELECT SUPERMAG.SMSPEC.ARTICLE C1,SUPERMAG.SMDOCUMENTS.CLIENTINDEX C2,SUPERMAG.SMDOCUMENTS.DOCSTATE
C3,SUPERMAG.SMDATEDOCS.DOCTYPE C4,MAX("SUPERMAG"."SMDATEDOCS"."DATEDAT")
M1,COUNT(*) M2 FROM SUPERMAG.SMSPEC,SUPERMAG.SMDOCUMENTS,SUPERMAG.SMDATEDOCS
WHERE SUPERMAG.SMDATEDOCS.DOCTYPE=SUPERMAG.SMSPEC.DOCTYPE AND SUPERMAG.SMDATEDOCS.DOCTYPE
=SUPERMAG.SMDOCUMENTS.DOCTYPE AND SUPERMAG.SMDATEDOCS.ID=SUPERMAG.SMSPEC.DOCID
AND SUPERMAG.SMDATEDOCS.ID=SUPERMAG.SMDOCUMENTS.ID AND (SUPERMAG.SMDOCUMENTS.DOCTYPE
='OR') GROUP BY SUPERMAG.SMSPEC.ARTICLE,SUPERMAG.SMDOCUMENTS.CLIENTINDEX,
SUPERMAG.SMDOCUMENTS.DOCSTATE,SUPERMAG.SMDATEDOCS.DOCTYPE;
begin
dbms_stats.gather_table_stats('"SUPERMAG"','"MV_FOR_ORDERS"',NULL,dbms_stats.auto_sample_size);
end;
/
CREATE BITMAP INDEX"SUPERMAG"."MV_FOR_ORDERS_INDX1"
ON "SUPERMAG"."MV_FOR_ORDERS"
("C1") TABLESPACE INDX
COMPUTE STATISTICS;
CREATE BITMAP INDEX"SUPERMAG"."MV_FOR_ORDERS_INDX2"
ON "SUPERMAG"."MV_FOR_ORDERS"
("C2") TABLESPACE INDX
COMPUTE STATISTICS;
Цитата: query_rewrite_integrity=stale_tolerated;
INDX у меня на страйпе, NOLOGGING. Результат: предыдущая генерация - секунд за 15, по всем контрактам и поставщикам за 10 минут, сгенерировано около 3000 заказов. Жду критики.
PS при переносе пробелы пропали. прошу внимательнее :(