Insertion of data after creating index on empty table or creating unique index after inserting data on oracle?

前端 未结 3 1693
我寻月下人不归
我寻月下人不归 2020-12-10 15:00

Which option is better and faster? Insertion of data after creating index on empty table or creating unique index after inserting data. I have around 10M rows to insert. W

3条回答
  •  Happy的楠姐
    2020-12-10 15:33

    As others have said, insert first and add the index later. If the table already exists and you have to insert a pile of data like this, drop all indexes and constraints, insert the data, then re-apply first your indexes and then your constraints. You'll certainly want to do intermediate commits to help preclude the possibility that you'll run out of rollback segment space or something similar. If you're inserting this much data it might prove useful to look at using SQL*Loader to save yourself time and aggravation.

    I hope this helps.

提交回复
热议问题