{
  "id": "dotnet/ef-core-query-split-query-timeout",
  "signature": "System.InvalidOperationException: An error occurred while executing the query. The query has been canceled. See InnerException for details. -> Microsoft.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.",
  "signature_zh": "System.InvalidOperationException: 执行查询时发生错误。查询已被取消。有关详细信息，请参见InnerException。 -> Microsoft.Data.SqlClient.SqlException (0x80131904): 执行超时已过期。在操作完成之前超时时间已到，或者服务器未响应。",
  "regex": "Execution Timeout Expired.*split query|AsSplitQuery",
  "domain": "dotnet",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "Entity Framework Core's split query mode (enabled via AsSplitQuery()) generates multiple SQL queries that execute sequentially, and the total time exceeds the default 30-second command timeout, especially with large datasets or multiple includes.",
  "root_cause_type": "generic",
  "root_cause_zh": "Entity Framework Core的分割查询模式（通过AsSplitQuery()启用）生成按顺序执行的多个SQL查询，总时间超过默认的30秒命令超时，尤其是在大型数据集或多个Include的情况下。",
  "versions": [
    {
      "version": "EF Core 5.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "EF Core 6.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "EF Core 7.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "EF Core 8.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "SQL Server 2016+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Removing AsSplitQuery() and relying on single query with joins, which may cause cartesian explosion",
      "why_fails": "Single queries with many Includes can result in huge result sets and memory pressure, leading to different performance issues.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "Setting CommandTimeout to a very high value (e.g., 5 minutes) globally in DbContext options",
      "why_fails": "This masks the underlying performance issue and may cause other queries to hang indefinitely.",
      "fail_rate": 0.2,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Increase the command timeout specifically for the problematic query using .CommandTimeout(120) on the DbContext or query-level.",
      "success_rate": 0.8,
      "how": "Increase the command timeout specifically for the problematic query using .CommandTimeout(120) on the DbContext or query-level.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Optimize the query by reducing the number of Includes, using explicit loading, or batching data retrieval with multiple queries.",
      "success_rate": 0.9,
      "how": "Optimize the query by reducing the number of Includes, using explicit loading, or batching data retrieval with multiple queries.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Increase the command timeout specifically for the problematic query using .CommandTimeout(120) on the DbContext or query-level.",
    "Optimize the query by reducing the number of Includes, using explicit loading, or batching data retrieval with multiple queries."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://learn.microsoft.com/en-us/ef/core/querying/single-split-queries",
  "official_doc_section": null,
  "error_code": "0x80131904",
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.85,
  "resolvable": "true",
  "first_seen": "2023-08-05",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}