Prepare Query Suggestions timer job takes a long time to run in SharePoint 2013
- Change the clean-up interval. To do this, launch a SharePoint management shell, and then enter the following PowerShell commands:
$ssa = Get-SPEnterpriseSearchServiceApplication -Identity "Search Service Application"
$ssa.QueryLogSettings.CleanupDays = <Days>
Note The <Days> placeholder represents the number of days that you want to set as the retention value. There is no "correct" value here; and you should start with a large number and then decrease it until you find the best retention period for your environment. For example, start with 270 days, then 180 days, and then 90 days. Make sure that you set a reasonable retention value for your production environment, as reducing it too much may affect other search features, including ranking, relevance, and query suggestions.
- Wait for the Query Logging timer job to run.
The Query Logging timer job checks which tables need cleanup, and it will run an internal stored procedure to purge the records from the underlying tables in a 24-hour period.
Article ID: 3174023 - Last Review: 09/20/2016 22:00:00 - Revision: 2.0