I created a new SQLite database in disk file with AutoCommit turned off using:
my $dsn = "dbi:SQLite:dbname=folder/path/file.db";
my $user = "";
my $password = "";
my $dbh = DBI->connect($dsn, $user, $password,{AutoCommit => 0});
#… Doing some processing on the database (Creating tables/Inserting rows/Updating fields)
#… Many query SELECT statements here
# My question here: Does SQLite read data from memory or disk each time a SELECT statement is performed.
When querying data (using SELECT SQL statements), does SQLite read data from disk file or memory? Does SQLite perform any disk activity (which is lower in performance than memory RAM activity)?
Side-Notes:
The answer of this question will help guide me to choose whether to load DB from disk file to memory first, then process and query data from it, and at end save it back to disk file after finishing, or the other option to use simply the solution of turning off the AutoCommit.
Note: My created database won't get too large, so I don't worry about the issue of getting my database filling the memory.
If SQLite reads data from disk each time a SELECT query statement is called, then this will cause a tremendous performance lag compared to copying DB to memory solution mentioned in my previous question.
Helpful Answer Approaching:
• Performance testing by Schwern (mentioned here) shows that operating and querying on whether an in-memory or in-disk database results the same performance.