On Wednesday, 13 March, 2013 at 06:15, Michael Black wrote: > You're simply missing the where clause on your update so you're updating the > entire database every time you do an insert. > update_counter(k1,k2 count=count+1,expires=now+count*1day) where field1=k1 > and field2=k2; > > And a (k1,k2) index would help that update a lot.
That's pseudo code. In real life it looks more like UPDATE counters SET count=count+1, expires=?+count*(24*60*60) WHERE k1=? AND k2=? As in the schema I listed, (k1,k2) is the primary key so there's already an index on it. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users