The SQLite optimizations must be carried out at two different times: once in a unique and permanent way for the database and another time for each connection that is made. Below are the configurations that should be made in each case.
These configurations are set only once and affect the database persistently, meaning they do not need to be reconfigured each time a connection is established:
Sets the database journal mode to "WAL" (Write-Ahead Logging), which improves performance in concurrent operations.