I wanted to copy data from a materialized view to a table, only adding sequence value for PK. There are 800k rows of data.
Results:
- the
create materialized view
statement creates a view in 8-10 seconds (hasnull
for intended PK column) - inserting this same data into a table using the same select + adding sequence executed 10+ minutes and then I just killed it, thinking that the select is at fault
- copying all the data from the materialized view + only adding sequence into a table took 15mins to do
- using the
drop materialized view .. preserve table
option, I got a table within a couple seconds, after said 8-10 seconds to create the materialized view itself. Then I wanted to “quickly” fill in the PK row and it ran for 10+ minutes.
The table has no indexes or anything else.
I tried to update another column with a constant value and it took the same 10+ minutes.
I am using Oracle 19c in this case.
What could be potential causes for this? How could inserting/updating value in one column take so much longer than inserting all the 800k rows?