redis runtime_error ai_generated partial

ERR 执行 GRAPH.QUERY 时出错:查询在 10000 毫秒后超时

ERR Error executing GRAPH.QUERY: Query timed out after 10000 ms

ID: redis/redisgraph-query-timeout

其他格式: JSON · Markdown 中文 · English
75%修复率
82%置信度
1证据数
2024-05-20首次发现

版本兼容性

版本状态引入弃用备注
RedisGraph 2.10.0 active
Redis Stack 7.2.0 active
RedisGraph 2.12.0 active

根因分析

由于复杂的图遍历、大型结果集或低效的 Cypher 查询,RedisGraph 查询超过了配置的超时限制。

English

A RedisGraph query exceeded the configured timeout limit due to complex graph traversal, large result sets, or inefficient Cypher queries.

generic

官方文档

https://redis.io/docs/latest/commands/graph.query/

解决方案

  1. 通过添加索引优化 Cypher 查询:GRAPH.QUERY mygraph 'CREATE INDEX ON :Person(age)',然后重写查询以在 WHERE 子句中使用索引属性。
  2. 使用 GRAPH.EXPLAIN 进行查询分析以识别瓶颈,然后将复杂查询分解为更小的步骤或使用 LIMIT 减少结果集大小。
  3. 通过在 GRAPH.QUERY 命令中设置更高的 TIMEOUT 值来增加特定查询的超时,例如:GRAPH.QUERY mygraph 'MATCH ...' --timeout 30000。

无效尝试

常见但无效的做法:

  1. 65% 失败

    Increasing the timeout globally via GRAPH.CONFIG SET TIMEOUT may allow slow queries to run but can cause resource exhaustion or block other operations.

  2. 70% 失败

    Removing all indexes to speed up writes actually slows down graph queries, making the timeout worse.

  3. 50% 失败

    Restarting Redis clears the query cache but doesn't optimize the underlying query pattern, so the timeout will recur.