|
-
Hello,
I have to run the following in production. the following does a cartesian produc bettwen the two tables with 4000 records selected form P2 and 700 from I. I do not have sequences defined currently, so I do need the "+ rownum"
This is taking almost 4 hrs to run in the devp area to insert 2.5million rows. (I already have 0.5+ records in the table.
INSERT INTO PERM
SELECT I.CNY#, (select NVL(max(record#),0)+1 from PERM where cny# = I.CNY#)+rownum RECORD#,
'T' STATUS, I.RECORD#, P2.ELEMENT, P2.PERMISSION
FROM PERM P2, USERINFO I WHERE P2.CNY#= 571 AND P2.USERREC = 1 AND I.CNY# != 571 AND I.ADMIN = '1';
Is there any was I can improve this? If so how?
Note: I have indexes on the relevent columns.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|