Skip to content
Release: Australia · Updated: 2026-03-12 · Official documentation · View source

Slow queries and SQL debugging

Debugging SQL and slow queries can help you resolve slowness issues in an instance.

When you debug an instance, you can either enable SQL debugging to look for slow queries or you can look for slow queries by checking the Slow Queries [sys_query_pattern] table by navigating to System Diagnostics > Stats > Slow Queries. This table stores all the slow queries in the instance.

When you search the table, look for queries that contain domain_path to determine if any slow queries are due to the domain path in your instance.

If you do find slow queries, try to analyze why they are slow.

Common reasons for slow queries

  • A query has too many OR conditions (for more information, see Contains queries and domain access). In the domain hierarchy, place the user or a domain at a hierarchy level where contains or visibility is not needed.
  • The query method is not the domain path query method (for more information, see Domain paths query method): If you are not using the domain path query method, contact Customer Service and Support.
  • A query needs a database to be indexed so you can see what is in the database quickly. If you can identify the slow query, run the "explain plan" to see if there are options for indexing available. The "explain plan" is a function of SQL that shows the query and what is going on with it.

Parent Topic:Domain separation recommended practices for service providers

Related topics

Domain separation explained

Domain separation hierarchies

Context and domain separation

Segregating and securing data with domain separation

Alternatives to domain separation

Evaluating the need for domain separation

Benefits of domain separation

How a database query works with domain separation

Domain separation levels of support

Service provider reference architecture

Domain separation terms

Domain-separate a custom table

Customizing domain properties and themes

Managing domain separation for specific uses

Configuring domain separation with the domain picker

Domain separation performance considerations

Setting up domain hierarchies

Checking domain logs for errors and warnings

Importance of the Default domain

Contains queries and domain access

Domain paths query method

Before Query business rules

Avoiding domain path in scripts

Domain assignments

Domain separation and the Customer Service Management (CSM) plugin