Is it good to drop and recreate index frequently

时间:2018-02-03 08:56:59

标签: oracle performance bulk-operations

We have a performance issue for a table which has indexes. It takes 1 hour to load, but if we drop the indexes and recreate them after each load it executes in 30 minutes.

Is it a feasible solution to drop and recreate the indexes for that table after each cycle?

1 个答案:

答案 0 :(得分:3)

It sounds like what you're trying to do is a bulk data load into a table with several indexes, but you're finding that the load is unacceptably slow if the indexes are present

If that's your problem, Oracle allows you to disable and rebuild indexes, rather than having to drop and recreate them: https://docs.oracle.com/cd/E18283_01/server.112/e17120/indexes004.htm#CIHJCEAJ

Oracle also give this guidance on when to use this feature:

Use unusable or invisible indexes when you want to improve the performance of bulk loads, test the effects of removing an index before dropping it, or otherwise suspend the use of an index by the optimizer.