In QGIS, if I open some GeoPackage file like mylayers.gpkg, it will create two files named mylayers.gpkg-shm and mylayers.gpkg-wal in the same folder. After I close QGIS, these files disappear. I understand that they are temporary files, but I wonder what their purpose is.

  • 1
    not sure but something related with write protection in case of concurrent/simultaneous file access ...
    – Snaileater
    Commented Apr 15, 2021 at 7:21
  • 1
    wal is the write ahead log, no idea what shm is though
    – Ian Turton
    Commented Apr 15, 2021 at 7:29

1 Answer 1


As the SQLite core of a GeoPackage is a single-file based RDB, it needs to utilize temporary support structures to guarantee atomic transaction management.

SQLite supports different mechanics to achieve this, and the QGIS specific GPKG implementation defaults to Write Ahead Logging (WAL), available in SQLite > 3.7, where

  • the *.gpkg-wal file holds the WAL for the current connection; this file keeps a progressive data log of the transactional state of the DB between COMMITs (or ROLLBACKs)
  • the *.gpkg-shm SHhared Memory file manages concurrent access to the DB via an index to the WAL
  • 4
    The "GPKG implementation" above refers specifically to QGIS GPKG implementation. It sets the GeoPackage databases into WAL mode, if they are not already, with pragma command PRAGMA journal_mode=WAL; sqlite.org/wal.html#activating_and_configuring_wal_mode. What users should know is not to send .gpkg files to other users before the .wal and .shm files have disappeared.
    – user30184
    Commented Apr 15, 2021 at 8:08
  • @user30184 amended.
    – geozelot
    Commented Apr 15, 2021 at 8:56
  • 1
    Does it mean that two or more desktop users can simultaneously edit the same GeoPackage file - stored, for example, on a shared network disk - without corrupting data?
    – Yaroslav
    Commented Apr 16, 2021 at 9:28
  • 2
    @Yaroslav Yes, SQLite is ACID compliant and concurrency save for readers, but supports only a single writer process at a time; if a transaction is open running INSERT, UPDATE or DDL statements, other transactions have to wait until the current transaction was committed/rollback-ed. In practice, though, in a QGIS edit session, the lock happens at save time, so you won't feel much of this limitation.
    – geozelot
    Commented Apr 16, 2021 at 10:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.