↑↓ 选择↵ 打开⌫ 切换范围完整搜索

PG.CENTER 连接 PostgreSQL 文档、百科与生态知识。由 Pigsty 维护。

Wiki / 函数

width_bucket

返回直方图中包含 operand 的桶编号。该直方图把 low 到 high 的范围划分为 count 个等宽桶。各桶包含下边界、不包含上边界。对于小于 low 的输入,返回 0;对于大于等于 high 的输入,返回 count+1。如果 low > high,行为会镜像反转,此时桶 1 表示刚好位于 low 下方的那个桶,并且包含边界的一侧改为上边界。

英文手册覆盖始于 PostgreSQL 7.1. 来源历史与运行验证各自保留独立版本边界。

当前阅读 PG 18·选择有来源记录的版本

group
math
group label
Mathematical Functions And Operators
lang
en
layout
table-new
pages
functions-math.html
prose only
false
zh from
未知

版本定义 PG 18

返回直方图中包含 operand 的桶编号。该直方图把 low 到 high 的范围划分为 count 个等宽桶。各桶包含下边界、不包含上边界。对于小于 low 的输入,返回 0;对于大于等于 high 的输入,返回 count+1。如果 low > high,行为会镜像反转,此时桶 1 表示刚好位于 low 下方的那个桶,并且包含边界的一侧改为上边界。
width_bucket ( operand numeric, low numeric, high numeric, count integer ) → integer
返回直方图中包含 operand 的桶编号。该直方图把 low 到 high 的范围划分为 count 个等宽桶。各桶包含下边界、不包含上边界。对于小于 low 的输入,返回 0;对于大于等于 high 的输入,返回 count+1。如果 low > high,行为会镜像反转,此时桶 1 表示刚好位于 low 下方的那个桶,并且包含边界的一侧改为上边界。
width_bucket ( operand double precision, low double precision, high double precision, count integer ) → integer
返回直方图中包含 operand 的桶编号。该直方图把 low 到 high 的范围划分为 count 个等宽桶。各桶包含下边界、不包含上边界。对于小于 low 的输入,返回 0;对于大于等于 high 的输入,返回 count+1。如果 low > high,行为会镜像反转,此时桶 1 表示刚好位于 low 下方的那个桶,并且包含边界的一侧改为上边界。
width_bucket ( operand anycompatible, thresholds anycompatiblearray ) → integer
给定一个列出各桶包含性下边界的数组,返回 operand 所落入的桶编号。对于小于第一个下界的输入,返回 0。operand 和数组元素可以是任何具有标准比较操作符的类型。thresholds 数组必须有序,且最小值在前,否则会得到意外结果。

函数签名与重载

width_bucket ( operand numeric, low numeric, high numeric, count integer ) → integer → integer
返回直方图中包含 operand 的桶编号。该直方图把 low 到 high 的范围划分为 count 个等宽桶。各桶包含下边界、不包含上边界。对于小于 low 的输入,返回 0;对于大于等于 high 的输入,返回 count+1。如果 low > high,行为会镜像反转,此时桶 1 表示刚好位于 low 下方的那个桶,并且包含边界的一侧改为上边界。
width_bucket ( operand double precision, low double precision, high double precision, count integer ) → integer → integer
返回直方图中包含 operand 的桶编号。该直方图把 low 到 high 的范围划分为 count 个等宽桶。各桶包含下边界、不包含上边界。对于小于 low 的输入,返回 0;对于大于等于 high 的输入,返回 count+1。如果 low > high,行为会镜像反转,此时桶 1 表示刚好位于 low 下方的那个桶,并且包含边界的一侧改为上边界。
width_bucket ( operand anycompatible, thresholds anycompatiblearray ) → integer → integer
给定一个列出各桶包含性下边界的数组,返回 operand 所落入的桶编号。对于小于第一个下界的输入,返回 0。operand 和数组元素可以是任何具有标准比较操作符的类型。thresholds 数组必须有序,且最小值在前,否则会得到意外结果。

比较版本

来源引用

完整定义与证据 JSON

定义来源

center · PostgreSQL 18 · b7bd9cda

正文语言: zh-Hans · ca936764