Skip to content
Snippets Groups Projects
  • Eelco Dolstra's avatar
    fd9c77df
    * Use SQLite 3.7.0's write-ahead logging (WAL mode). This is a lot · fd9c77df
    Eelco Dolstra authored
      faster than the old mode when fsyncs are enabled, because it only
      performs an fsync() when doing a checkpoint, rather than at every
      commit.  Some timings for doing a "nix-instantiate /etc/nixos/nixos
      -A system" after modifying the stdenv setup script:
    
        42.5s - SQLite 3.6.23 with truncate mode and fsync
         3.4s - SQLite 3.6.23 with truncate mode and no fsync
        32.1s - SQLite 3.7.0 with truncate mode and fsync
        16.8s - SQLite 3.7.0 with WAL mode and fsync, auto-checkpoint
                every 1000 pages
         8.3s - SQLite 3.7.0 with WAL mode and fsync, auto-checkpoint
                every 8192 pages
         1.7s - SQLite 3.7.0 with WAL mode and no fsync
    
      The default is now to use WAL mode with fsyncs.  Because WAL doesn't
      work on remote filesystems such as NFS (as it uses shared memory),
      truncate mode can be re-enabled by setting the "use-sqlite-wal"
      option to false.
    fd9c77df
    History
    * Use SQLite 3.7.0's write-ahead logging (WAL mode). This is a lot
    Eelco Dolstra authored
      faster than the old mode when fsyncs are enabled, because it only
      performs an fsync() when doing a checkpoint, rather than at every
      commit.  Some timings for doing a "nix-instantiate /etc/nixos/nixos
      -A system" after modifying the stdenv setup script:
    
        42.5s - SQLite 3.6.23 with truncate mode and fsync
         3.4s - SQLite 3.6.23 with truncate mode and no fsync
        32.1s - SQLite 3.7.0 with truncate mode and fsync
        16.8s - SQLite 3.7.0 with WAL mode and fsync, auto-checkpoint
                every 1000 pages
         8.3s - SQLite 3.7.0 with WAL mode and fsync, auto-checkpoint
                every 8192 pages
         1.7s - SQLite 3.7.0 with WAL mode and no fsync
    
      The default is now to use WAL mode with fsyncs.  Because WAL doesn't
      work on remote filesystems such as NFS (as it uses shared memory),
      truncate mode can be re-enabled by setting the "use-sqlite-wal"
      option to false.