This code is being generated from a java application.
Main Topics
Browse All Topicsthis update statement is taking forever. The explain plan is attached.
INSERT INTO LEDGERENTRY_TEMP( LEDGERENTRY_ID,CONN_ID) SELECT LEDGERENTRY.LEDGERENTRY_ID
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I don't know if you have up-to-date statistics, but the last two lines in the explain plan gives a clue as to possible ways to improve this. The LEDGERENTRY table has two references in the where clause to specific values:
LEDGERENTRY.ISLEDGERENTRYA
LEDGERENTRY.LOT_ID= :3
I assume the first one is a Y/N value, but if the lot_id is fairly distinct then an index on that allow the query to use an index on LEDGERENTRY.
Does BUSEVENTHIST.BUSEVENTHIST_
Finally, what role do the other tables (BUSEVENTHIST,BUSEVENTDEF,
Good luck!
Is this correct?
INSERT INTO LEDGERENTRY_TEMP( LEDGERENTRY_ID,CONN_ID) SELECT LEDGERENTRY.LEDGERENTRY_ID
Actually, it's FIRST_ROWS or ALL_ROWS and RULE, CHOOSE, or COST but I think I knowwhat you mean. The OR could still throw it off. Let me see if I can do some of what I suggested. Give me a couple of minutes and we'll see if we can convince it to use what's there.
P.S. You did run stats on the tables AND the indexes, right?
Business Accounts
Answer for Membership
by: DrSQLPosted on 2008-08-06 at 10:31:10ID: 22172695
Check this section of the WHERE:
PE_ID = :"SYS_B_1" OR REALEVENTTYPE.REALEVENTTYP E_ID = :"SYS_B_2"
E_ID in (:"SYS_B_1", :"SYS_B_2" )
(REALEVENTTYPE.REALEVENTTY
You have an OR in the middle of a bunch of "AND" conditions. Try putting parens around the OR condition so that you can be certain of what it is doing. Is an OR necessary, or can you write it with an in:
REALEVENTTYPE.REALEVENTTYP
I'm not sure what syntax you are using (I don't recognize the :"), though posted in the Oracle/plSQL section.
Good luck!