sqliteperliodbivacuum

Does VACUUM perform I/O operations outside the database directory?


With an SQLite database I access through a Perl program I can use the INSERT and DELETE commands but not VACUUM, which raises:

disk I/O error

If I run the program as root I got no problem so it must be some permission issue. I checked permissions for every file involved in the process and it should be OK. Is the VACUUM command performing I/O operations outside the database directory?

my $dbh = DBI->connect("dbi:SQLite:someDB.db", undef, undef, {RaiseError => 1, AutoCommit => 1});
my $sth = $dbh->prepare("VACUUM;");
$sth->execute;

Solution

  • If you'd like to see I/O operations which are executed during VACUUM you can use strace. It will list all system calls executed by SQLite, including disk IO.

    strace sqlite3 someDB.db 'VACUUM;'