I'm trying to create an index on a large partitioned table. I started with a simple CREATE INDEX which took 5 hours.
In my next attempt, I tried below steps:
- Create index as UNUSABLE
- Loop through all the subpartitions and rebuild index with PARALLEL 8 NOLOGGING using below code.
CREATE OR REPLACE PROCEDURE sp_rebuild_indx_partition (i_indexname VARCHAR2) AS
BEGIN
FOR sp_idx IN ( SELECT disp.index_name, disp.subpartition_name
FROM dba_ind_subpartitions disp
WHERE EXISTS (SELECT 1
FROM dba_tab_partitions dtp
WHERE dtp.table_name = '<TABLE_NAME>'
AND disp.partition_name = dtp.partition_name)
AND disp.index_name = i_indexname
AND disp.status = 'UNUSABLE')
LOOP
EXECUTE IMMEDIATE 'ALTER INDEX '||sp_idx.index_name||' REBUILD SUBPARTITION '||sp_idx.subpartition_name||' PARALLEL 8 NOLOGGING';
END LOOP;
END;
The second attempt took almost the same time as initial attempt.
I checked the parallel parameters and noticed parallel execution might not be enabled. My knowledge on understanding these parameters are limited. Can someone help me understand if I'm doing something wrong or if the parameters need to be altered to take advantage of the parallel execution?
NAME TYPE VALUE
------------------------------- ------- ------
_parallel_broadcast_enabled boolean TRUE
awr_pdb_max_parallel_slaves integer 10
containers_parallel_degree integer 65535
fast_start_parallel_rollback string LOW
max_datapump_parallel_per_job string 50
optimizer_ignore_parallel_hints boolean FALSE
parallel_adaptive_multi_user boolean FALSE
parallel_degree_limit string CPU
parallel_degree_policy string MANUAL
parallel_execution_message_size integer 16384
parallel_force_local boolean FALSE
parallel_instance_group string
parallel_max_servers integer 0
parallel_min_degree string 1
parallel_min_percent integer 0
parallel_min_servers integer 0
parallel_min_time_threshold string AUTO
parallel_servers_target integer 0
parallel_threads_per_cpu integer 1
recovery_parallelism integer 0
Using:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Windows 11