Question:In the SQL Server Error Logs I saw the following message:

The query processor ran out of internal resources and could not produce a query plan. This is a rare event and only expected for extremely complex queries or queries that reference a very large number of tables or partitions. Please simplify the query

Is there a way to find the query ? I know I can use something like Extended Events which would allow me to trap the sql text , but what about finding a query that has executed and triggered this error

Answer:If you don’t have the query , you can use some DMVs to extract large queries .The limitation is that the data from DMVs is refreshed after every SQL Server restart.

Here are some example queries utilitising DMVs which could assist you to track down the query .

SQL Server Find high impact queries with sys.dm_exec_query_stats

SQL Server Performance Top Queries by Total CPU Time

How to find Longest running queries in SQL Server

Look for queries with long IN lists, an unusually large number of UNIONS & nested sub queries. In my experience these have contributed a large percentage of the reason for these error messages.

On occasion , the root cause may be fixed by a the service pack upgrade.

本文数据库(mssql)相关术语:熊片数据库 mssql数据库 oracle数据库 pubmed数据库 access数据库 万方数据库

主题: SQLCPUSQL Server
tags: query,queries,SQL,Server,large,The,DMVs
本文标题:ERROR 8623 The query processor ran out of internal resources and could not produ ...

技术大类 技术大类 | 数据库(mssql) | 评论(0) | 阅读(125)