在12.2上,IMPDP已经设置了并行,但是在trace中发现索引创建始终使用串行,而不是并行。
SQL> create table a(m number,n number) parallel 4;
SQL> create index a_ind on a(m) parallel 3;
SQL> !expdp test/test@PDB1 dumpfile=b.dmp directory=my_dir
SQL> !impdp test/test@PDB1 directory=my_dir dumpfile=b.dmp parallel=2 TRACE=480301
DW trace显示index创建使用的是parallel=1,而不是parallel=2!(多么细心的客户)。
=====================
PARSING IN CURSOR #140037561274968 len=170 dep=2 uid=79 oct=1 lid=79
tim=841576694 hv=1135291776 ad=’61d1c0b0′ sqlid=’apjngud1uqbc0′
CREATE TABLE “TEST”.”A” (“M” NUMBER, “N” NUMBER) SEGMENT CREATION DEFERRED
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING TABLESPACE “USERS” PARALLEL 4
END OF STMT
=====================
PARSING IN CURSOR #140037558550112 len=114 dep=2 uid=79 oct=9 lid=79
tim=842113538 hv=68235534 ad=’6374e7a8′ sqlid=’0u96wjh212c8f’
CREATE INDEX “TEST”.”A_IND” ON “TEST”.”A” (“M”) PCTFREE 10 INITRANS 2
MAXTRANS 255 TABLESPACE “USERS” PARALLEL 1 <=======PARALLEL 1, even if parallel=3 was set during index creation phase
END OF STMT
=====================
PARSING IN CURSOR #140427279060200 len=115 dep=2 uid=111 oct=9 lid=111
tim=8385394705 hv=1693801083 ad=’77900cf8′ sqlid=’3t4ktqdkgaqmv’
CREATE INDEX “TEST”.”A_IND” ON “TEST”.”A” (“M”) PCTFREE 10 INITRANS 2
MAXTRANS 255 TABLESPACE “SYSTEM” PARALLEL 2 <========PARALLEL 2
END OF STMT
于是开了个bug,结果开发的解释是,这是期待的行为,因为,“我们发现这样更快”!
BUG 26091146 – IMPDP CREATE INDEX WITH PARALLEL 1 IGNORING COMMAND LINE PARALLEL=2, Development explained that this is an expected behavior supplying the following explanation:
“General support for parallel import of most object type, including indexes, is a 12.2 feature, which led to study of parallel creation of individual indexes. What was found was that using parallel index creation was generally slower than non-parallel. That led to a decision to backport the change to not use parallel index creation.”
因为在12.2新feature的开发过程中,我们研究了一下impdp时的index的创建,发现“一般情况下”串行比并行建索引更快,所以我们决定把impdp时的索引都改成串行创建,并且在创建完成后,再使用’ALTER INDEX … PARALLEL n’ 设置索引的并行度,以实现查询时的并行效果。
好吧,开发永远都是(无)对(厘)的(头),如果您的测试表明“一般情况下”并行建索引更快,请告诉我们,我们将为您再开一个新bug,或者将这个bug重新打开。
