XWiki v13.10.9 stuck on initialing (12%) after acquired change log lock

It turns out that table xwikistatsvisit contains too many items, and the size is over 3GB. Therefore the initialization was unable to complete before tomcat timing out. And I suspect the XWiki instance had been through automatic testing for years, and each time of testing access will generate a record in this table.

I resolved the issue by deleting all records in the table before starting tomcat. However, the SQL delete command took over two hours to complete on a medium testing virtual machine with SSD, 4 CPUs of Intel i9 and 8GB of RAM, running MariaDB v10.9.2. Also, the hypervisor needs to enable “PAE/NX” and “Nested Vt-x/ADM-V” for higher performance; otherwise, the computing task will get stuck forever.

I am still open to suggestions about how to handle this situation better.