improve sqlite db write