Troubleshooting SQL Tuning issues
Symptom
End users are reporting slowness with specific actions. Some SQL queries take a long time to complete.
Scope
- It affects one or more users across multiple servers in a server group.
- It affects back-end processes instead of user activities.
Diagnosing and reporting an issue
Step | Task | Description |
---|---|---|
1 | Identify the inefficient SQL statement | Use the Analyzing-AR-System-Log-Analyzer-output topic or database tools to identify the inefficient SQLs that are impacting performance. Identify the expected times and the actual response time. Note that some SQLs, such as running complex reports, are expected to take time to complete. Focus your analysis on SQL statements that are expected to return quickly but cause a delay. |
2 | Check if there is an obvious problem with the query | Look for obvious problems with the query, such as:
Note that all of these examples are fine as long as there are other components in the Where clause that would use an index. If any of these obvious problems exist with the SQL in question, you may have one of the following problems:
|
3 | Determine if an index could be used but does not exist | Check to see if the SQL statement includes qualifications that are likely to use an index, such as:
If there a qualification that you suspect should use an index but appears not to be, check the form properties to ensure that an index exists. In most cases, to use the index, it should be present in the first column/field of a composite index. If you believe that an index does not exist but should exist, create a support case. |
4 | Determine the origination of the SQL | SQLs are often dynamically generated by the AR System server based on workflow, permissions, database type, and field population. Using API/SQL/Filter logging with AR System Log Analyzer, identify if the SQL was generated based on a specific piece of workflow or if it was a result of a simple user query. Create a support case if it appears that the SQL was generated by the Out-of-the-box application. |
5 | Determine if User Behavior can improve the situation | If the SQL resulted from a customer query, identify if the problem can be resolved with user behavior. For example, a user looking for 'All Open' cases may not be able to get a fast result because an index is not used. Narrow the scope of the query such as searching for 'All My Open' cases. |
6 | Identify workflow that caused the inefficient SQL | If you can identify the workflow, table field, or other reason for the query, create a support case so that BMC can provide a short and a long-term solution. |
7 | Find a solution | a. Use the following table to troubleshoot specific problems with slow SQL statements. b. If the cause has not been found or no solution is available, proceed to the next step to gather logs and create a support case. |
8 | Collect relevant logs | If you're still experiencing issues after following the steps or if you're unable to complete any of the preceding steps, use the Viewing and collecting logs by using the Support Assistant tool to collect the API, SQL, and Filter logs relevant to the problem. You must run the utility on each server that you enabled the logs on. Rename the zipped file to contain the server name. BMC Support will request for these logs when you submit a case on performance issues. |
9 | Create a Support Ticket | Collect and send output of AR Log Analyzer and detailed information when creating a case with BMC Support:
|
Errors and resolution
Error | Where | Resolution | Reference |
---|---|---|---|
Index is missing | Developer Studio | Add an Index | |
Missing indexes for the field "Parent Request ID" (1000002706) on the form AST:CMDB Associations | Developer Studio | Add an Index |