What is the fastest way to insert data into an Oracle table?

前端 未结 8 2025
逝去的感伤
逝去的感伤 2020-12-30 07:22

I am writing a data conversion in PL/SQL that processes data and loads it into a table. According to the PL/SQL Profiler, one of the slowest parts of the conversion is the a

相关标签:
8条回答
  • 2020-12-30 07:57

    Drop the index, then insert the rows, then re-create the index.

    0 讨论(0)
  • 2020-12-30 08:01

    Here are my recommendations on fast insert.

    Trigger - Disable any triggers associated with a table. Enable after Inserts are complete.

    Index - Drop Index and re-create it after your Inserts are complete.

    Stale stats - Re-analyze table and index stats.

    Index de-fragmentation - Rebuild Index if needed Use No Logging -Insert using INSERT APPEND (Oracle only). This approach is very risky approach, no redo logs are generated therefore you can’t do a rollback - make a backup of table before you start and don't try on live tables. Check if your db has similar option

    Parallel Insert: Running parallel insert will get the job faster.

    Use Bulk Insert Constraints - Not much overhead during inserts but still a good idea to check, if it is still slow after even after step 1

    You can learn more on http://www.dbarepublic.com/2014/04/slow-insert.html

    0 讨论(0)
提交回复
热议问题