diff options
| author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2008-10-03 07:33:10 +0000 |
|---|---|---|
| committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2008-10-03 07:33:10 +0000 |
| commit | 706a308806a066017c63024c454bb02953c9822c (patch) | |
| tree | 4c763cb1f96c4b89caec213c123bdc5b910991bd /doc/src | |
| parent | 2cc1633a35a57fe2c2670c43691ab9ffa582f3ff (diff) | |
Add relation fork support to pg_relation_size() function. You can now pass
name of a fork ('main' or 'fsm', at the moment) to pg_relation_size() to
get the size of a specific fork. Defaults to 'main', if none given.
While we're at it, modify pg_relation_size to take a regclass as argument,
instead of separate variants taking oid and name. This change is
transparent to typical use where the table name is passed as a string
literal, like pg_relation_size('table'), but will break queries like
pg_relation_size(namecol), where namecol is of type name. text-type input
still works, and using a non-schema-qualified table name is not very
reliable anyway, so this is unlikely to break anyone's queries in practice.
Diffstat (limited to 'doc/src')
| -rw-r--r-- | doc/src/sgml/func.sgml | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 05f0aabddd0..31ef6dc864d 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -1,4 +1,4 @@ -<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.447 2008/09/11 17:32:33 tgl Exp $ --> +<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.448 2008/10/03 07:33:08 heikki Exp $ --> <chapter id="functions"> <title>Functions and Operators</title> @@ -12417,7 +12417,7 @@ postgres=# select * from pg_xlogfile_name_offset(pg_stop_backup()); <tbody> <row> - <entry><function>pg_column_size</function>(<type>any</type>)</entry> + <entry><literal><function>pg_column_size</function>(<type>any</type>)</literal></entry> <entry><type>int</type></entry> <entry>Number of bytes used to store a particular value (possibly compressed)</entry> </row> @@ -12437,19 +12437,22 @@ postgres=# select * from pg_xlogfile_name_offset(pg_stop_backup()); </row> <row> <entry> - <literal><function>pg_relation_size</function>(<type>oid</type>)</literal> + <literal><function>pg_relation_size</function>(<parameter>relation</parameter> <type>regclass</type>, <parameter>fork</parameter> <type>text</type>)</literal> </entry> <entry><type>bigint</type></entry> - <entry>Disk space used by the table or index with the specified OID</entry> + <entry> + Disk space used by the specified fork, <literal>'main'</literal> or + <literal>'fsm'</literal>, of a table or index with the specified OID + or name. The table name can be qualified with a schema name + </entry> </row> <row> <entry> - <literal><function>pg_relation_size</function>(<type>text</type>)</literal> + <literal><function>pg_relation_size</function>(<parameter>relation</parameter> <type>regclass</type>)</literal> </entry> <entry><type>bigint</type></entry> <entry> - Disk space used by the table or index with the specified name. - The table name can be qualified with a schema name + Shorthand for <literal>pg_relation_size(..., 'main')</literal> </entry> </row> <row> @@ -12475,21 +12478,11 @@ postgres=# select * from pg_xlogfile_name_offset(pg_stop_backup()); </row> <row> <entry> - <literal><function>pg_total_relation_size</function>(<type>oid</type>)</literal> - </entry> - <entry><type>bigint</type></entry> - <entry> - Total disk space used by the table with the specified OID, - including indexes and toasted data - </entry> - </row> - <row> - <entry> - <literal><function>pg_total_relation_size</function>(<type>text</type>)</literal> + <literal><function>pg_total_relation_size</function>(<type>regclass</type>)</literal> </entry> <entry><type>bigint</type></entry> <entry> - Total disk space used by the table with the specified name, + Total disk space used by the table with the specified OID or name, including indexes and toasted data. The table name can be qualified with a schema name </entry> @@ -12511,7 +12504,12 @@ postgres=# select * from pg_xlogfile_name_offset(pg_stop_backup()); <para> <function>pg_relation_size</> accepts the OID or name of a table, index or - toast table, and returns the size in bytes. + toast table, and returns the size in bytes. Specifying + <literal>'main'</literal> or leaving out the second argument returns the + size of the main data fork of the relation. Specifying + <literal>'fsm'</literal> returns the size of the + Free Space Map (see <xref linkend="storage-fsm">) associated with the + relation. </para> <para> |
