Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2012
    Posts
    3

    Unanswered: Update Query Optimization

    Hi, Please let me know your suggestions in optimizing the following update query.

    Update <partitioned_table>
    set <field_ind> = 'Y'
    where
    <field_ind> = 'N'
    and <Key1> in (select <Key1> from <temp table>)

    1. <paritioned_table> is a range partition table on date field.
    2. There is no index on <field_ind>
    3. <Key1> is part of the composite primary key in <partioned table> and also for <temp table>
    4. When i run the explain plan, i see a full scan on <partitioned_table> and range scan on <temp table>.
    I want to have the range scan on <paritioned table>.

    Let me know your thoughts or if you need more details
    Last edited by mouli_rvm; 04-13-12 at 16:03. Reason: Sorry about the Typo

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    if "<field_ind> = 'N'" then no need to do any UPDATE (set <field_ind> = 'N')

    so is this a trick question?
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Apr 2012
    Posts
    3
    Sorry about the typo, updated the question

  4. #4
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •