文档首页
MySQL 8.4 参考手册
8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

14.20.5 窗口函数的限制14.20.5 Window Function Restrictions

SQL 标准对窗口函数施加了限制,即不能在 UPDATE 或 DELETE 语句中用于更新行。但允许在这些语句的子查询中使用此类函数(用于选择行)。The SQL standard imposes a constraint on window functions that they cannot be used in UPDATE or DELETE statements to update rows. Using such functions in a subquery of these statements (to select rows) is permitted.

MySQL 不支持以下窗口函数特性:MySQL does not support these window function features:

  • DISTINCT 聚合窗口函数的语法。DISTINCT syntax for aggregate window functions.

  • 嵌套窗口函数。Nested window functions.

  • 依赖于当前行的值的动态帧端点。Dynamic frame endpoints that depend on the value of the current row.

解析器识别这些窗口结构,但它们仍然不被支持:The parser recognizes these window constructs which nevertheless are not supported:

  • GROUPS 帧单位说明符已解析,但会产生错误。仅支持 ROWS 和 RANGE。The GROUPS frame units specifier is parsed, but produces an error. Only ROWS and RANGE are supported.

  • 用于帧规范的 EXCLUDE 子句已解析,但会产生错误。The EXCLUDE clause for frame specification is parsed, but produces an error.

  • IGNORE NULLS 已解析,但会产生错误。仅支持 RESPECT NULLS。IGNORE NULLS is parsed, but produces an error. Only RESPECT NULLS is supported.

  • FROM LAST 已解析,但会产生错误。仅支持 FROM FIRST。FROM LAST is parsed, but produces an error. Only FROM FIRST is supported.

对于给定的SELECT,最多支持 127 个窗口。请注意,一个查询可以使用多个SELECT子句,并且每个子句最多支持 127 个窗口。不同窗口的数量被定义为命名窗口与作为任何窗口函数OVER子句的一部分指定的任何隐式窗口之和。你还应该注意,使用大量窗口的查询可能需要增加默认线程栈大小(thread_stack系统变量)。A maximum of 127 windows is supported for a given SELECT. Note that a single query may use multiple SELECT clauses, and each of these clauses supports up to 127 windows. The number of distinct windows is defined as the sum of the named windows and any implicit windows specified as part of any window function's OVER clause. You should also be aware that queries using very large numbers of windows may require increasing the default thread stack size (thread_stack system variable).