If you have 4 set clauses, the those 4 fields will be updated with the same 
values for all the rows matching the where clause with just a single call to 

If you actually want to update only 1 of the fields in 1 record, then you must 
bind the current values (which are unknown and need to be determined first) of 
the other fields and make sure that your where clause matches only the 1 
intended record.

-----Urspr√ľngliche Nachricht-----
Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im 
Auftrag von ghalwasi
Gesendet: Montag, 11. September 2017 15:02
An: sqlite-users@mailinglists.sqlite.org
Betreff: Re: [sqlite] [EXTERNAL] Performance impact of UPDATEing multiple 
columns vs few columns

hi Darko,

>If you're preparing that statement more than once then you are wasting
time, there's no reason whatsoever to do it. You're also wasting time if you 
make a bind call to set any column that hasn't changed since the last time you 
executed the statement.

>The entire row is rewritten when updating so the most efficient way to
it is to call sqlite3_prepare_v2 once, then bind any columns that have changed, 
call sqlite3_step to execute the statement, then call sqlite3_reset to reuse 
the statement, then go back to binding any columns that have changed and repeat 
the other steps. sqlite3_reset does not clear any column bindings.

Thanks for the explanation. It makes sense.


Sent from: http://sqlite.1065341.n5.nabble.com/
sqlite-users mailing list

 Gunter Hick
Software Engineer
Scientific Games International GmbH
FN 157284 a, HG Wien
Klitschgasse 2-4, A-1130 Vienna, Austria
Tel: +43 1 80100 0
E-Mail: h...@scigames.at

This communication (including any attachments) is intended for the use of the 
intended recipient(s) only and may contain information that is confidential, 
privileged or legally protected. Any unauthorized use or dissemination of this 
communication is strictly prohibited. If you have received this communication 
in error, please immediately notify the sender by return e-mail message and 
delete all copies of the original communication. Thank you for your cooperation.

sqlite-users mailing list

Reply via email to