选择 打开 改范围 完整检索页

pgsql.cc 提供对 postgresql.org 官网内容的中文翻译,由 Pigsty 团队维护。

文档 / 函数百科 / 窗口函数

FUNCTION窗口函数

ntile

返回一个从1到参数值的整数,并将分区划分为尽可能相等的值。

Returns an integer ranging from 1 to the argument value, dividing the partition as equally as possible.

窗口函数 引入 9.0(基线) 现存至 20 devel 1 条签名 0 次签名变更

分组
窗口函数
签名数
1 条
引入版本
9.0(基线)
状态
现存
签名变更
未变过
本版来源
本站译文

PostgreSQL 18 手册 · 9.22 窗口函数 官方文档

版本轨迹

相对 PostgreSQL 17 无变化。

签名

PostgreSQL 18 里 ntile 的 1 条签名,按上游手册顺序排列。参数名用斜体,类型用弱化色, 之后是返回类型。说明取自本站手册译文:标「沿用」的借用了另一版的译文,标「EN」的本站暂无译文、按英文原文显示。

  1. ntile ( num_buckets integer ) → integer

    返回一个从1到参数值的整数,并将分区划分为尽可能相等的值。

演化历史

相邻两个大版本之间的差异,新的在前。版本号链到该版的签名。

  1. PostgreSQL 13 ← 12 手册重排

    这一跳手册重排了函数表的写法,签名文本整体改写,只记函数的增删,不逐条比较签名。

签名矩阵

每条签名在给出了签名的 18 个版本里的存在情况;方格指向该版的签名。只在正文里提到此函数、没有给出签名的版本不列进来,上面的版本轨迹里仍然有它们。签名文本在 PostgreSQL 13 前后写法不同,跨越那一跳的同一条签名会显示成两行。

存在 不存在

签名 9.09.19.29.39.49.59.61011121314151617181920
ntile ( num_buckets integer ) → integer 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在

同组函数

函数 签名 主签名 版本变动 最近变更
WINDOW FUNCTIONS 窗口函数 7 个
first_value基线 1 first_value ( value anyelement ) [ null treatment ] → anyelement 191 次
返回在窗口帧的第一行求得的value。 现存
lag基线 1 lag ( value anycompatible [, offset integer [, default anycompatible ]] ) [ null treatment ] → anycompatible 192 次
返回分区中在当前行之前offset行的value;如果没有这样的行,则返回default(必须与value相兼容的类型)。 现存
last_value基线 1 last_value ( value anyelement ) [ null treatment ] → anyelement 191 次
返回在窗口帧的最后一行求得的value。 现存
lead基线 1 lead ( value anycompatible [, offset integer [, default anycompatible ]] ) [ null treatment ] → anycompatible 192 次
返回分区中在当前行之后offset行的value; 如果没有这样的行,则返回default(必须与value兼容的类型)。 现存
nth_value基线 1 nth_value ( value anyelement, n integer ) [ null treatment ] → anyelement 191 次
返回在窗口帧的第n行求得的value(从1开始计数);如果没有这样的行,则返回NULL。 现存
ntile基线 1 ntile ( num_buckets integer ) → integer
返回一个从1到参数值的整数,并将分区划分为尽可能相等的值。 现存
row_number基线 1 row_number () → bigint
返回其分区内的当前行数,从1开始计数。 现存