I am loading a huge amount of data into three tables and currently the scripts drop the indexes on these tables (one is unique), loads the data and then recreates the indexes.
Would it be more effective to load the data and then rebuild the indexes?
OK, then
1. Load your data.
2. Rebuild your indexes.
However, depending on how much your indexes change, you might be better off dropping/recreating the indexes.
Bear in mind that (1) maintaining indexes is going to have an impact on your performance during data loads and (2) rebuilding indexes can impose a fair amount of storage during the rebuild.
But in this case index would be changed with each new record. As a matter of fact batch operations are more efficient than the same changes applied to each record, thus creating a new index is far less expensive.
I agree with SEM especially if you have a couple of indexes on the table. Drop the indexes, perform the load, and then re-create the indexes. I have two instances that use SQL*Loader to load any where from 300K to 700K records each night each. This is the way that I go.
Terry
**************************
* General Disclaimor - Please read *
**************************
Please make sure your post is in the CORRECT forum, has a descriptive title, gives as much detail to the problem as possible, and has examples of expected results. This will enable me and others to help you faster...
I would say, it depends. I can think of two different scenarios of data load.
1. If you loading a huge amount of data in a huge table then you may want to rebuild the indexes after the load is complete.
2. If you are doing complete refresh of the tables then you are better off dropping the indexes before load and recreating them afterwards.
If scenario one applies to you then I would suggest that you may want to consider partitioning. That way you have an option of rebuilding just the partition index.
Another point. If the data is loaded using SQL loader using direct mode then the it ignores the unique constraint on the table rendering index invalid.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.