As part of a new process requirement, we will be creating table and which will contain approximately 3000 - 4000 records. We have a copy of these records in plain text on a txt file.
Loading these records in the table leaves me with two choices
Use a shell script to generate SQL file containing INSERT Statements for these records
Use of SQL Loader.
Which of the above two options would be most efficient, in terms of taking up DB resources, utilisation on the client server on which this is to be performed.
I do realise the number of records are rather small, but we may have to repeat this activity with higher number of records (close to 60,000) in which case I would like to have the best possible option configured from the start.
SQL*Loader
is the more efficient method. It gives you more control. You have an option do DIRECT
load and NOLOGGING
, which will reduce redo log generation, and when indexes have been disabled (as part of direct loading), the loading goes faster. Downside, is if load is interupted, indexes are left unusable
.
But, considering the advantages, SQL*Loader
is the best approach. And you will feel the difference, when you have millions of records, and having so many loading jobs running in parallel. I heard DBA complaining about the log size, when we do CONVENTIONAL INSERT
statement loading, with 200+ such jobs, running in parallel. The larger the data volume, the larger the difference you'll see in performance.
SQL*Loader will be more efficient than thousands of individual INSERT
statements. Even with 60,000 rows, though, both approaches should complete in a matter of seconds.
Of the two options you mentioned, SQL*Loader is definitely the way to go - much faster and more efficient.
However, I'd choose another approach - external tables . Has all the benefits of SQL*Loader, and allows you to treat your external csv file like an ordinary database table.
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.