As Wout pointed out, if you had a unique index on pl_id and also a conditional index where checkbox == 1, then you could limit thee update to only the two rows needing update which would cause the update to take constant time no matter how many rows were in the table. ie: create unique index plindex1 on pltable (pl_id); -- unless it is already constrained unique or is a primary key create index plindex2 on pltable (pl_id) where checkbox == 1; Then do your update as update pltable set checkbox = (case when pl_id == ?1 then 1 else 0 end) where pl_id == ?1 or checkbox == 1; will update only the two rows.