sqlite3 seems to be a major bottleneck. Buffer? Or switch?