Symptoms
Navigating to a knowledge article that is attached to an excessive number of tasks using the kb_view page can be slow when trying to render the the "Most recent tasks" list.
Release
All Releases
Environment
If you have a KB article that is associated with hundreds or thousands of tasks.
Cause
There is an OOB UI macro on the kb_view.do page that lists the last 10 tasks which have been associated with the current kb_knowledge record.
UI Macro: List of tasks to which a Knowledge article has been attached
https://__INSTANCE__.service-now.com/sys_ui_macro.do?sys_id=66f0b492ff213100a822ffffffffff9e
The UI macro is responsible for showing the "Most recent tasks" section at the bottom of the knowledge base article.
The UI macro runs the following query:
SELECT m2m_kb_task0.`sys_id` FROM (m2m_kb_task m2m_kb_task0 LEFT JOIN task task1 ON m2m_kb_task0.`task` = task1.`sys_id` ) WHERE m2m_kb_task0.`kb_knowledge` = 'ba62f655dbea2a407c3f76fabf961912' ORDER BY task1.`sys_created_on` DESC limit 0,10;
The query that gets run to find the most recent tasks is slower for KB articles that are attached to a higher count of tasks:
Resolution
Workaround #1
Set the glide.knowman.recent_tasks.display system property to false to completely disable listing the tasks to which articles have been attached.
Workaround #2
Enable versioning; this may improve the query by adding filters on the kb_knowledge.summary and kb_knowledge.sys_created_on
Workaround #3
Customize the code for the UI macro and filter out the top KB articles by task count (eg., add an additional filter before the "tasks.query();" call in the UI macro to filter out these top 10 KB articles)