SQLite operations are slow (leading to application freezes)
Versions
- OS: Arch Linux 5.5.2-arch1-1
- Gajim version: 1:r17178.eebc393f-1
- GTK version: 1:3.24.13-1
- Python-nbxmpp version: 0.6.8.r301.g0c7293b-1
Steps to reproduce the problem
- Connect gajim to an account with 100+ MUCs and 100+ contacts
Behaviour
I experience a long pause on account (re)connection, during which gajim is using 100% CPU and the UI is completely unresponsive. Using strace
reveals gajim is spending a lot of time writing to the SQLite database.
Suggested resolution
I shut down gajim, and executed PRAGMA journal_mode=wal;
in ~/.cache/gajim/cache.db
and ~/.local/share/gajim/logs.db
with sqlite3
(i.e. enabling Write-Ahead Logging). This seems to make gajim noticeably quicker to start up (i.e. it hangs for a shorter time period). Since there don't seem to be any downsides to turning on WAL, maybe gajim should consider enabling it for these databases by default?