Index Hint on Update ?

  • I have to update millions of rows. I'm breaking it into batches based on date. I have an index on date, but the estimated query plan shows that it's going to do a table scan. Is there a way to get it to use the index ? I don't have a primary key, just an identity field for uniqueness.

  • select a.*, b.*

    from a

    join b with (index(b_col1_index)) on a.id=b.id

    Something like this?

  • Maybe,.. join the table to itself, with a hint on the join. But I don't have a unique index to join on.

  • select *

    FROM TableA with (index(IX_TableA))

    IX_TableA = Index on date

    I am thinking something like this

  • The index hint works with a select. The problem is that I am doing a lot of updates.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply