nav-img
Advanced

Why Is My SQL Query So Slow?

  1. You can view the slow SQL logs for slow SQL queries and view their performance characteristics (if any) to locate the cause.

    For RDS for SQL Server, you can query dynamic management views (DMVs) to locate the cause of slow queries. For details on DMVs, visit the Microsoft official website.

  2. View the CPU usage metric of your DB instance.
  3. Create read replicas to offload read pressure on primary DB instances.
  4. When multiple associated tables are queried, indexes must be created for the associated fields.
  5. Do not use the SELECT statement to scan all tables. You can specify fields or add the WHERE condition.