sqlite3 - SQLite updating ONE record is very (relatively) slow -


i know sqlite's 'problem' when inserting/updating many rows, that's not case here.

i'm updating 1 field in 1 row, indexed pk, in table ~ 250 records. query takes ~ 200 ms. sounds little, it's huge.

why 1 simple update query take 200 ms?? reads blazing fast.

i've tried:

  • begin , commit -- no change, because it's 1 statement
  • pragma journal_mode=persist -- no change, apparently disk io isn't problem?
  • removing update statement -- works wonderfully time!, it's not persistent

to compare mysql on same system: 0.6ms in similar database.

i don't need transactional security (acid?) or whatever call that. if computer crashes during query, i'm fine losing all changes. mysql (innodb) has option this: innodb_flush_log_at_trx_commit. sqlite have that?

i'm using sqlite-3.7.9, if matters.

yes, sqlite has option mysql's innodb_flush_log_at_trx_commit:

pragma synchronous=off 

and works charm. no acid, yes speed. incredible reason update takes < 1ms.

there improving journal_mode:

pragma journal_mode=memory or pragma journal_mode=off 

both fast , not acid. rollback isn't issue, both in case. off fastest, because doesn't create journal @ (?).


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -