Troubleshoot > Troubleshooting: Common database errors > Troubleshooting: Slow execution of queries

Troubleshooting: Slow execution of queries

Slow query execution time is usually related to hardware and network limitations, or report design. After eliminating hardware or network limitations as a source of the slow response time, you can apply the following suggested tips to your report designs to speed execution:

  • Limit the number of records kept in a database table, such as avoid saving several years of incident records in a single database table. The more records that are kept in a file, the larger the index is. The larger the index is, the slower queries run.
  • Limit sorting layers. If the raw SQL contains more than two ORDER BY statements, the processing time increases. Each ORDER BY statement significantly increases execution time.
  • Use joins instead of subreports. Although subreports are universal and allow greater portability over different servers, they execute SQL queries against the database one time for every record. For example, a report with 100 records with a subreport in the Details section executes 101 SQL statements. A joined report of equivalent size executes only once.
  • Use indexes where possible. Typically, the Unique key of any table is already indexed; however, in a join, placing a key on the field used to join the two tables dramatically increases the speed to execute. Add indexes only with the guidance of your Service Manager administrator. Adding too many indexes to a Service Manager table can affect performance.

Related topics

Key type definitions
Troubleshooting: Database debug
Tuning: Designing keys for queries
Tuning: Key selection algorithms
Tuning: Number of fields in files