We are observing that creating partitionaligned indexes on a table having few (approx. 50-100) partitions takes only 10-15 seconds but if we add large number (1500+) ofempty partitions the same create index takes 10 minutes +. The table has 70000 rows in one partition.
We are looking for suggestions how to improve the performance of create index.
Our scenario is like this:
We have Fact table having hourly partitions containing hourly data. The table contains 2-3 months of data, therefore has around 2000 partitions.
To get new hour data, we create a staging table based of same partition scheme. We download one hour of data (ie one partition) into the staging table. Apply partitionaligned indexes to the staging table. Swap the partition having data with the fact table partition.
This step of applying indexes on the staging table is taking a huge time. If there were fewer partitions in the partition function, this apply indexes would have been quick.
The staging table is based of partition function having 1000+ partitions but has data in only one partition. What can we do to apply indexes quickly on the staging table.