leavelllusion
leavelllusion

Reputation: 329

Should I add WHERE when setting values to constant?

Will the next command work faster if I uncomment the third line?

UPDATE "Users"
SET "Type"=0
-- WHERE "Type"<>0

Upvotes: 0

Views: 49

Answers (1)

Laurenz Albe
Laurenz Albe

Reputation: 247205

The command will be faster (at least not slower) for the following reasons:

  • It has to modify fewer rows.

  • It has to add fewer index entries.

  • Any ON UPDATE trigger will fire fewer times.

Upvotes: 1

Related Questions