title: How to optimize the query to update a table column with a column in another table in oracle
body: <p>I have 2 tables. One table is cr_archive which has around 9000000 records. It has a column called v_sales_person which does not have values. I have another table called table_2 which has the same column called v_sales_person in which there are values. Both tables have columns called product_label,account_num. I want to select data from table _2 which has the same product_labels and account_num as in cr_archive and update the column v_sales_person in cr_archive with the values in table_2 which fulfill the above conditions(using oracle). I tried the following query.</p>
  
  <pre><code>update cr_archive a
  set a.v_sales_person = (select distinct b.v_sales_person from table_2 b where a.account_num = b.account_num and A.PRODUCT_LABEL=b.PRODUCT_LABEL )
  /
  commit
  /
  </code></pre>
  
  <p>But the query is taking more than 6 hours to process and don't know whether it gives the output. I have 2 questions.
  1. Is the above query correct?
  2. Is there any method to optimize the above query.</p>