UPDATE performance

  • I've inherited a job that reads millions of rows and updates an IMAGE data type field to NULL based on a few conditions, including data older than 90 days. It's quite possible a lot of rows are already NULL. Do you think performance would be improved by adding:

    AND Image_field is not NULL ?

    Or does checking the value of the field add more overhead ?? I suppose it partly depends on the total percentage that will get updated, but I though I'd ask if there's a general "rule".

    Thanks

    EDIT.... looks as though less than 10% of the rows will actually need to get updated. 90% - 98% are already NULL

  • It can help if there's an index, but not sure that it would help on an index column.

  • Including that in the Where clause should at least reduce the amount of logging overhead from the update, since less rows will be logged. I generally include that kind of thing in my code.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

Viewing 3 posts - 1 through 2 (of 2 total)

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