📄 catalogs.sgml
字号:
</row> <row> <entry><structfield>anl_scale_factor</structfield></entry> <entry><type>float4</type></entry> <entry></entry> <entry>Multiplier for reltuples to add to <structfield>anl_base_thresh</></entry> </row> <row> <entry><structfield>vac_cost_delay</structfield></entry> <entry><type>integer</type></entry> <entry></entry> <entry>Custom <varname>vacuum_cost_delay</> parameter</entry> </row> <row> <entry><structfield>vac_cost_limit</structfield></entry> <entry><type>integer</type></entry> <entry></entry> <entry>Custom <varname>vacuum_cost_limit</> parameter</entry> </row> </tbody> </tgroup> </table> <para> The autovacuum daemon will initiate a <command>VACUUM</> operation on a particular table when the number of updated or deleted tuples exceeds <structfield>vac_base_thresh</structfield> plus <structfield>vac_scale_factor</structfield> times the number of live tuples currently estimated to be in the relation. Similarly, it will initiate an <command>ANALYZE</> operation when the number of inserted, updated or deleted tuples exceeds <structfield>anl_base_thresh</structfield> plus <structfield>anl_scale_factor</structfield> times the number of live tuples currently estimated to be in the relation. </para> <para> Any of the numerical fields can contain <literal>-1</> (or indeed any negative value) to indicate that the system-wide default should be used for this particular value. Observe that the <structfield>vac_cost_delay</> variable inherits its default value from the <varname>autovacuum_vacuum_cost_delay</> configuration parameter, or from <varname>vacuum_cost_delay</> if the former is set to a negative value. The same applies to <structfield>vac_cost_limit</>. </para> </sect1> <sect1 id="catalog-pg-cast"> <title><structname>pg_cast</structname></title> <indexterm zone="catalog-pg-cast"> <primary>pg_cast</primary> </indexterm> <para> The catalog <structname>pg_cast</structname> stores data type conversion paths, both built-in paths and those defined with <command>CREATE CAST</command>. </para> <table> <title><structfield>pg_cast</> Columns</title> <tgroup cols=4> <thead> <row> <entry>Name</entry> <entry>Type</entry> <entry>References</entry> <entry>Description</entry> </row> </thead> <tbody> <row> <entry><structfield>castsource</structfield></entry> <entry><type>oid</type></entry> <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry> <entry>OID of the source data type</entry> </row> <row> <entry><structfield>casttarget</structfield></entry> <entry><type>oid</type></entry> <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry> <entry>OID of the target data type</entry> </row> <row> <entry><structfield>castfunc</structfield></entry> <entry><type>oid</type></entry> <entry><literal><link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.oid</literal></entry> <entry> The OID of the function to use to perform this cast. Zero is stored if the data types are binary compatible (that is, no run-time operation is needed to perform the cast). </entry> </row> <row> <entry><structfield>castcontext</structfield></entry> <entry><type>char</type></entry> <entry></entry> <entry> Indicates what contexts the cast may be invoked in. <literal>e</> means only as an explicit cast (using <literal>CAST</> or <literal>::</> syntax). <literal>a</> means implicitly in assignment to a target column, as well as explicitly. <literal>i</> means implicitly in expressions, as well as the other cases. </entry> </row> </tbody> </tgroup> </table> <para> The cast functions listed in <structname>pg_cast</structname> must always take the cast source type as their first argument type, and return the cast destination type as their result type. A cast function can have up to three arguments. The second argument, if present, must be type <type>integer</>; it receives the type modifier associated with the destination type, or <literal>-1</> if there is none. The third argument, if present, must be type <type>boolean</>; it receives <literal>true</> if the cast is an explicit cast, <literal>false</> otherwise. </para> <para> It is legitimate to create a <structname>pg_cast</structname> entry in which the source and target types are the same, if the associated function takes more than one argument. Such entries represent <quote>length coercion functions</> that coerce values of the type to be legal for a particular type modifier value. Note however that at present there is no support for associating non-default type modifiers with user-created data types, and so this facility is only of use for the small number of built-in types that have type modifier syntax built into the grammar. </para> <para> When a <structname>pg_cast</structname> entry has different source and target types and a function that takes more than one argument, it represents converting from one type to another and applying a length coercion in a single step. When no such entry is available, coercion to a type that uses a type modifier involves two steps, one to convert between data types and a second to apply the modifier. </para> </sect1> <sect1 id="catalog-pg-class"> <title><structname>pg_class</structname></title> <indexterm zone="catalog-pg-class"> <primary>pg_class</primary> </indexterm> <para> The catalog <structname>pg_class</structname> catalogs tables and most everything else that has columns or is otherwise similar to a table. This includes indexes (but see also <structname>pg_index</structname>), sequences, views, composite types, and some kinds of special relation; see <structfield>relkind</>. Below, when we mean all of these kinds of objects we speak of <quote>relations</quote>. Not all columns are meaningful for all relation types. </para> <table> <title><structname>pg_class</> Columns</title> <tgroup cols=4> <thead> <row> <entry>Name</entry> <entry>Type</entry> <entry>References</entry> <entry>Description</entry> </row> </thead> <tbody> <row> <entry><structfield>relname</structfield></entry> <entry><type>name</type></entry> <entry></entry> <entry>Name of the table, index, view, etc.</entry> </row> <row> <entry><structfield>relnamespace</structfield></entry> <entry><type>oid</type></entry> <entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry> <entry> The OID of the namespace that contains this relation </entry> </row> <row> <entry><structfield>reltype</structfield></entry> <entry><type>oid</type></entry> <entry><literal><link linkend="catalog-pg-type"><structname>pg_type</structname></link>.oid</literal></entry> <entry> The OID of the data type that corresponds to this table's row type, if any (zero for indexes, which have no <structname>pg_type</> entry) </entry> </row> <row> <entry><structfield>relowner</structfield></entry> <entry><type>oid</type></entry> <entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry> <entry>Owner of the relation</entry> </row> <row> <entry><structfield>relam</structfield></entry> <entry><type>oid</type></entry> <entry><literal><link linkend="catalog-pg-am"><structname>pg_am</structname></link>.oid</literal></entry> <entry>If this is an index, the access method used (B-tree, hash, etc.)</entry> </row> <row> <entry><structfield>relfilenode</structfield></entry> <entry><type>oid</type></entry> <entry></entry> <entry>Name of the on-disk file of this relation; 0 if none</entry> </row> <row> <entry><structfield>reltablespace</structfield></entry> <entry><type>oid</type></entry> <entry><literal><link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.oid</literal></entry> <entry> The tablespace in which this relation is stored. If zero, the database's default tablespace is implied. (Not meaningful if the relation has no on-disk file.) </entry> </row> <row> <entry><structfield>relpages</structfield></entry> <entry><type>int4</type></entry> <entry></entry> <entry> Size of the on-disk representation of this table in pages (of size <symbol>BLCKSZ</symbol>). This is only an estimate used by the planner. It is updated by <command>VACUUM</command>, <command>ANALYZE</command>, and a few DDL commands such as <command>CREATE INDEX</command>. </entry> </row> <row> <entry><structfield>reltuples</structfield></entry> <entry><type>float4</type></entry> <entry></entry> <entry> Number of rows in the table. This is only an estimate used by the planner. It is updated by <command>VACUUM</command>, <command>ANALYZE</command>, and a few DDL commands such as <command>CREATE INDEX</command>. </entry> </row> <row> <entry><structfield>reltoastrelid</structfield></entry> <entry><type>oid</type></entry> <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry> <entry> OID of the TOAST table associated with this table, 0 if none. The TOAST table stores large attributes <quote>out of line</quote> in a secondary table. </entry> </row> <row> <entry><structfield>reltoastidxid</structfield></entry> <entry><type>oid</type></entry> <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry> <entry> For a TOAST table, the OID of its index. 0 if not a TOAST table. </entry> </row> <row> <entry><structfield>relhasindex</structfield></entry> <entry><type>bool</type></entry> <entry></entry> <entry> True if this is a table and it has (or recently had) any indexes. This is set by <command>CREATE INDEX</command>, but not cleared immediately by <command>DROP INDEX</command>. <command>VACUUM</command> clears <structfield>relhasindex</> if it finds the table has no indexes. </entry> </row> <row> <entry><structfield>relisshared</structfield></entry> <entry><type>bool</type></entry> <entry></entry> <entry>True if this table is shared across all databases in the cluster. Only certain system catalogs (such as <structname>pg_database</structname>) are shared.</entry> </row> <row> <entry><structfield>relkind</structfield></entry> <entry><type>char</type></entry> <entry></entry> <entry> <literal>r</> = ordinary table, <literal>i</> = index, <literal>S</> = sequence, <literal>v</> = view, <literal>c</> = composite type, <literal>s</> = special, <literal>t</> = TOAST table </entry> </row> <row> <entry><structfield>relnatts</structfield></entry> <entry><type>int2</type></entry> <entry></entry> <entry> Number of user columns in the relation (system columns not counted). There must be this many corresponding entries in <structname>pg_attribute</structname>. See also <literal>pg_attribute.attnum</literal>. </entry> </row> <row> <entry><structfield>relchecks</structfield></entry> <entry><type>int2</type></entry> <entry></entry> <entry> Number of check constraints on the table; see <structname>pg_constraint</structname> catalog </entry> </row> <row> <entry><structfield>reltriggers</structfield></entry> <entry><type>int2</type></entry> <entry></entry> <entry> Number of triggers on the table; see <structname>pg_trigger</structname> catalog </entry> </row> <row> <entry><structfield>relukeys</structfield></entry> <entry><type>int2</type></entry> <entry></entry> <entry>unused (<emphasis>not</emphasis> the number of unique keys)</entry> </row> <row> <entry><structfield>relfkeys</structfield></entry> <entry><type>int2</type></entry> <entry></entry> <entry>unused (<emphasis>not</emphasis> the number of foreign keys on the table)</entry> </row> <row> <entry><structfield>relrefs</structfield></entry> <entry><type>int2</type></entry> <entry></entry> <entry>unused</entry> </row> <row> <entry><structfield>relhasoids</structfield></entry> <entry><type>bool</type></entry> <entry></entry> <entry> True if we generate an OID for each row of the relation. </entry> </row> <row> <entry><structfield>relhaspkey</structfield></entry> <entry><type>bool</type></entry> <entry></entry> <entry> True if the table has (or once had) a primary key. </entry> </row> <row> <entry><structfield>relhasrules</structfield></entry>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -