SQLite Forum

Different time spent in Windows and Linux
Login

Different time spent in Windows and Linux

(1) By lopot (Lyalot) on 2021-10-13 13:10:10 [link] [source]

I have a task, where I read a text file, parse it and save some contents in SQLite database. So there are only write-operations to database.
In Windows this task is performed in 75 seconds. In Linux - in 15 minutes.
Profiling of code displays that database operations take 90% of all task time.

Are there any suggestions about what settings in the SQLite can cause such a catastrophic difference in times?

(2) By Dan Kennedy (dan) on 2021-10-13 15:26:56 in reply to 1 [source]

It may be that the file-system on Windows is not syncing to disk when asked to, whereas Linux is.

Grouping your write operations into a transaction or transactions should help.

(3) By lopot (Lyalot) on 2021-10-14 06:05:34 in reply to 2 [link] [source]

Operations are grouped in both Windows and Linux. The problem was removed by enclosing the block of operations in "brackets": BEGIN TRANSACTION and COMMIT