Try removing the VACUUM call, there's no empty pages to defragment anyway. Furthermore, you're doing a bunch of PRAGMA calls that may or may not help. Try not doing those.
Try removing the VACUUM call, there's no empty pages to defragment anyway. Furthermore, you're doing a bunch of PRAGMA calls that may or may not help. Try not doing those.