mardi 28 avril 2015

alter table and insert perf (serial read/write detection)

I have a table 't' with an integer primary key 'k', I'd like to alter the table 't' to add one more column 'c' then fill the 'c' column in a C language iteration loop.

I extracted all the primary keys in a array then plan to prepare() an UPDATE query like this (pseudo code)

q=prepare("UPDATE t set c=? where k=?");
for(i=0;i<n;i++)  
{ x=k[i];
  bind(q,0,cvalue); bind(q,1,x);
}

Since the key 'x' that will be presented to the UPDATE query are the primary key in sequence, does SQLITE clever enough to avoid a bsearch on the k=?, in other word, does it detect the 'serial' write access.

Thanx in advance. Cheers, Phi

Aucun commentaire:

Enregistrer un commentaire