Matomo uses the database as a session handler. Matomo used to also support redis and file based session handlers, but these have been deprecated as of 2019 and do not work anymore.