简体   繁体   中英

Is it good to drop and recreate index frequently

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM