The log tables rely on indexes to perform queries fast. Over time these indexes get fragmented.
You need to ensure that you regularly defragment the log table indexes. If you are unsure about how to do this here are our recommendations:
On-Prem hosted SQL Server
If you host your own SQL Server you can use the stored procedure RebuildLogsIndexes
- Open SQL Server Management Studio
- Open a new query window in your ThinScale database
- Copy and paste EXEC RebuildLogsIndexes
- Right-click and select Execute or press F5
This will take a number of hours depending on the size of the fragmentation.
Azure SQL Server
Otherwise, if you host on Azure we recommend this script:
https://github.com/yochananrachamim/AzureSQL/blob/master/AzureSQLMaintenance.txt