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

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

支持中的版本: 当前版本 (18) / 17 / 16 / 15 / 14
开发中的版本: 19 / 20devel
已结束支持的版本: 13 / 12 / 11 / 10 / 9.6 / 9.5 / 9.4 / 9.3 / 9.2 / 9.1 / 9.0 / 8.4 / 8.3 / 8.2 / 8.1 / 8.0 / 7.4 / 7.3
历史版本。 PostgreSQL 9.1 已结束支持。 2016-10-27. 请参阅 当前版本手册.

45.4. pg_amop #

目录pg_amop存储关于与访问方法操作符族相关的操作符信息。对于操作符族中的每个成员操作符,此目录中都有一行。一个成员可以是搜索操作符,也可以是排序操作符。一个操作符可以出现在多个族中,但在同一个族中既不能出现在多个搜索位置,也不能出现在多个排序位置(虽然不太可能,但允许一个操作符同时用于搜索和排序)。

表 45.4. pg_amop 列

NameTypeReferencesDescription
amopfamilyoidpg_opfamily.oidThe operator family this entry is for
amoplefttypeoidpg_type.oidLeft-hand input data type of operator
amoprighttypeoidpg_type.oidRight-hand input data type of operator
amopstrategyint2 Operator strategy number
amoppurposechar Operator purpose, either s for search or o for ordering
amopoproidpg_operator.oidOID of the operator
amopmethodoidpg_am.oidIndex access method operator family is for
amopsortfamilyoidpg_opfamily.oidThe btree operator family this entry sorts according to, if an ordering operator; zero if a search operator

“搜索”操作符项表明可以搜索该操作符族的一个索引来找到所有满足 WHERE indexed_column operator constant 的行。显然,这样的操作符必须返回布尔值,并且其左输入类型必须匹配索引列的数据类型。

“排序”操作符项表明可以扫描该操作符族的一个索引,按照 ORDER BY indexed_column operator constant 所表示的顺序返回行。这样的操作符可以返回任何可排序的数据类型,但其左输入类型同样必须匹配索引列的数据类型。ORDER BY 的确切语义由 amopsortfamily 列指定,该列必须引用操作符结果类型的一个 btree 操作符族。

注意

当前假定排序操作符的排序顺序是被引用操作符族的默认值,即 ASC NULLS LAST。将来可能会通过增加额外的列来显式指定排序选项,从而放宽这一假定。

一个项的amopmethod必须和其所属操作符族的opfmethod相匹配(此处加入amopmethod是出于性能原因而对目录结构故意做出的反规范化)。此外,amoplefttype和amoprighttype也必须匹配被引用的pg_operator项的oprleft和oprright域。

报告文档问题

阅读 上游文档. 反馈更正前请先核对 当前版本手册.