I have the same issue as you. Latest nextcloud on Debian 12 with MariabDB 10.11.6.
The database seems to lock up. High CPU usage on the mariadbd process and any SELECT query hangs and gives no output.
We had a similar problem on an other VM with the same software (php, mariadb, etc.). It seems like a MariaDB bug. Maybe it would be better if we report on the MariaDB tracker?