Retrieving Logs getting slower over time

Retrieving Logs getting slower over time

Written by Giuseppe

Last published at: November 7th, 2022

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

 

  1. Open SQL Server Management Studio
  2. Open a new query window in your ThinScale database
  3. Copy and paste EXEC RebuildLogsIndexes
  4. Right-click and select Execute or press F5

 

Graphical user interface, text, application

Description automatically generated

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