Postgresql 中文操作指南
53.4. pg_amop #
目录_pg_amop_存储与访问方法运算符系列相关的运算符的信息。对于每个属于运算符系列的运算符,都有一个行。系列成员可以是_search_运算符或者_ordering_运算符。一个运算符可以出现在多个系列中,但不能在系列中的多个搜索位置或多个排序位置内出现。(运算符既用于搜索,又用于排序目的,虽然不太可能,但这是允许的。)
The catalog pg_amop stores information about operators associated with access method operator families. There is one row for each operator that is a member of an operator family. A family member can be either a search operator or an ordering operator. An operator can appear in more than one family, but cannot appear in more than one search position nor more than one ordering position within a family. (It is allowed, though unlikely, for an operator to be used for both search and ordering purposes.)
Table 53.4. pg_amop Columns
Table 53.4. pg_amop Columns
Column Type Description |
oid oid Row identifier |
amopfamily oid (references pg_opfamily.oid) The operator family this entry is for |
amoplefttype oid (references pg_type.oid) Left-hand input data type of operator |
amoprighttype oid (references pg_type.oid) Right-hand input data type of operator |
amopstrategy int2 Operator strategy number |
amoppurpose char Operator purpose, either s for search or o for ordering |
amopopr oid (references pg_operator.oid) OID of the operator |
amopmethod oid (references pg_am.oid) Index access method operator family is for |
amopsortfamily oid (references pg_opfamily.oid) The B-tree operator family this entry sorts according to, if an ordering operator; zero if a search operator |
“搜索”算子项指示可以针对该算子族的索引执行搜索以查找满足 WHERE indexed_column operator constant 的所有行。显然,此类算子必须返回 boolean,而且其左输入类型必须与索引的列数据类型相匹配。
A “search” operator entry indicates that an index of this operator family can be searched to find all rows satisfying WHERE indexed_column operator constant. Obviously, such an operator must return boolean, and its left-hand input type must match the index’s column data type.
“排序”算子项指示可以扫描该算子族的索引以按照 ORDER BY indexed_column operator constant 表示的顺序返回行。此类算子可返回任何可排序的数据类型,但同样,其左输入类型必须与索引的列数据类型相匹配。ORDER BY 的确切语义由 amopsortfamily 列指定,该列必须为算子结果类型的 B 树算子族引用。
An “ordering” operator entry indicates that an index of this operator family can be scanned to return rows in the order represented by ORDER BY indexed_column operator constant. Such an operator could return any sortable data type, though again its left-hand input type must match the index’s column data type. The exact semantics of the ORDER BY are specified by the amopsortfamily column, which must reference a B-tree operator family for the operator’s result type.
Note
目前,假定排序运算符的排序顺序是对引用的运算符系列的默认设置,即 ASC NULLS LAST。将来可以通过添加附加列来明确指定排序选项,从而使得这一点得到放松。
At present, it’s assumed that the sort order for an ordering operator is the default for the referenced operator family, i.e., ASC NULLS LAST. This might someday be relaxed by adding additional columns to specify sort options explicitly.
条目的 amopmethod 必须与其包含的操作符系列的 opfmethod 相匹配(包括 amopmethod ,这是一次出于性能原因的故意反规范化目录结构)。另外, amoplefttype 和 amoprighttype 必须分别与被引用 pg_operator 条目的 oprleft 和 oprright 字段相匹配。
An entry’s amopmethod must match the opfmethod of its containing operator family (including amopmethod here is an intentional denormalization of the catalog structure for performance reasons). Also, amoplefttype and amoprighttype must match the oprleft and oprright fields of the referenced pg_operator entry.