Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7218449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T21:29:01+00:00 2026-05-28T21:29:01+00:00

Currently my query is very heavy, the table (table A) I need to update

  • 0

Currently my query is very heavy, the table (table A) I need to update contains 21 million records
and another table (table B) contains 15 million records. for all the records that are in table B, the records in table A need to be updated.
Using the V$SESSION_LONGOPS I can see that the query is going to take 30 hours to complete. So does anyone know if it’s better to merge & update or just update

below my update query, i already set an index on the join table. this is only a temporary table I created which I will drop after the insert. (not an external table)

UPDATE ITEM_LOC IL
SET 
IL.STATUS= 'D'                    ,
IL.LAST_UPDATE_DATETIME= SYSDATE  ,
IL.LAST_UPDATE_ID = 'CNVOBJ_RNG'
where exists
(select il.item, il.loc from item_loc il
join DC_ITEM_LOC DC_IL ON DC_IL.ITEM = IL.ITEM AND DC_IL.LOC = IL.LOC);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T21:29:02+00:00Added an answer on May 28, 2026 at 9:29 pm

    This will not do what you expect. This will update every record of ITEM_LOC (if ITEM_LOC and DC_ITEM_LOC have at least one record in common). Your query is running the full subquery for each row of ITEM_LOC, this is why it takes so long.

    Your semi-join should be written like this:

    UPDATE ITEM_LOC IL
       SET IL.STATUS = 'D', 
           IL.LAST_UPDATE_DATETIME = SYSDATE, 
           IL.LAST_UPDATE_ID = 'CNVOBJ_RNG'
     WHERE EXISTS (SELECT il.item, il.loc
                     FROM DC_ITEM_LOC DC_IL
                    WHERE DC_IL.ITEM = IL.ITEM
                      AND DC_IL.LOC = IL.LOC);
    

    Updating a million rows should be a matter of seconds, not hours.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Dear all, I have a select query that currently produces the following results: DoctorName
I currently have a SQL query that returns a number of fields. I need
I have a query that gets all the info I need for a messaging
I currently have a table that is listed as follows: projects = Project.find(:all, :conditions
I have a table that gets updated very regularly throughout the day, so Im
I currently have a query that looks like this: SELECT NON EMPTY ([Measures].[TOTAL]) ON
I have a select query that currently produces the following results: Description Code Price
Hey guys I have a query that currently finds the latest comment for each
I'm having an issue with a query that currently uses LEFT JOIN weblog_data AS
I am currently developing a query builder application, basically, a simple graphical interface that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.