{"Entry":{"collection":"func","key":"pg-relation-size","name":"pg_relation_size","aliases":[],"metadata":{"changed_in":["8.4"],"changes":[{"descriptions_changed":false,"doc_overhaul":false,"from":"8.0","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"added","to":"8.1"},{"descriptions_changed":true,"doc_overhaul":false,"from":"8.3","group_changed":null,"signatures":{"added":["pg_relation_size ( relation regclass, fork text ) → bigint","pg_relation_size ( relation regclass ) → bigint"],"removed":["pg_relation_size ( oid ) → bigint","pg_relation_size ( text ) → bigint"]},"status":"changed","to":"8.4"},{"descriptions_changed":true,"doc_overhaul":false,"from":"9.0","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"changed","to":"9.1"},{"descriptions_changed":false,"doc_overhaul":true,"from":"12","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"changed","to":"13"}],"content_hash":"fbf2a74446e6db2b8deccccb615f72286b8caeb2739aa88eb70e90f7712b8fbc","first_version":"8.1","group":"admin","group_label":"System Administration Functions","groups":["admin"],"imported_at":"2026-09-27T17:57:29.61728+08:00","last_version":"20","name":"pg_relation_size","name_key":"pg_relation_size","position":29078,"present_in":["8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"signature":"pg_relation_size ( relation regclass [, fork text ] ) → bigint","signature_count":1,"slug":"pg-relation-size","source_rev":"b7bd9cda","summary":"Computes the disk space used by one “fork” of the specified relation.","summary_zh":""}},"Definition":{"Collection":"func","Key":"pg-relation-size","SourceDatabase":"center","Version":"18","SourceTable":"func","SourceKey":"pg-relation-size","SourceRevision":"b7bd9cda","Facts":{"description":"Computes the disk space used by one “fork” of the specified relation. (Note that for most purposes it is more convenient to use the higher-level functions pg_total_relation_size or pg_table_size, which sum the sizes of all forks.) With one argument, this returns the size of the main data fork of the relation. The second argument can be provided to specify which fork to examine:","description_html":"Computes the disk space used by one \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003efork\u003c/span\u003e”\u003c/span\u003e of the specified relation. (Note that for most purposes it is more convenient to use the higher-level functions \u003ccode class=\"function\"\u003epg_total_relation_size\u003c/code\u003e or \u003ccode class=\"function\"\u003epg_table_size\u003c/code\u003e, which sum the sizes of all forks.) With one argument, this returns the size of the main data fork of the relation. The second argument can be provided to specify which fork to examine:","description_zh":"","description_zh_html":"","doc":{"anchor":"FUNCTIONS-ADMIN-DBSIZE","file":"functions-admin.html","slug":"18"},"group":"admin","group_label":"System Administration Functions","lang":"en","layout":"table-new","pages":["functions-admin.html"],"prose_only":false,"signatures":[{"description":"Computes the disk space used by one “fork” of the specified relation. (Note that for most purposes it is more convenient to use the higher-level functions pg_total_relation_size or pg_table_size, which sum the sizes of all forks.) With one argument, this returns the size of the main data fork of the relation. The second argument can be provided to specify which fork to examine:","description_html":"Computes the disk space used by one \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003efork\u003c/span\u003e”\u003c/span\u003e of the specified relation. (Note that for most purposes it is more convenient to use the higher-level functions \u003ccode class=\"function\"\u003epg_total_relation_size\u003c/code\u003e or \u003ccode class=\"function\"\u003epg_table_size\u003c/code\u003e, which sum the sizes of all forks.) With one argument, this returns the size of the main data fork of the relation. The second argument can be provided to specify which fork to examine:","description_zh":"","description_zh_html":"","examples":[],"html":"\u003ccode class=\"function\"\u003epg_relation_size\u003c/code\u003e ( \u003cem class=\"parameter\"\u003e\u003ccode\u003erelation\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003eregclass\u003c/code\u003e [\u003cspan class=\"optional\"\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003efork\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e\u003c/span\u003e ] ) → \u003ccode class=\"returnvalue\"\u003ebigint\u003c/code\u003e","returns":"bigint","text":"pg_relation_size ( relation regclass [, fork text ] ) → bigint","zh_from":""}],"zh_from":""},"ManualEvidence":{"doc":{"anchor":"FUNCTIONS-ADMIN-DBSIZE","file":"functions-admin.html","slug":"18"}},"MeasuredEvidence":{}},"Text":{"Collection":"func","Key":"pg-relation-size","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"pg_relation_size","Summary":"计算指定关系的一个“分支”所使用的磁盘空间。（注意在大多数情况下，使用更高级的函数 pg_total_relation_size或pg_table_size更方便，它们将所有分支的大小相加。）使用一个参数，这将返回关系的主数据分支的大小。第二个参数可以用来指定要检查哪个分支：","BodyHTML":"计算指定关系的一个\u003cspan\u003e“\u003cspan\u003e分支\u003c/span\u003e”\u003c/span\u003e所使用的磁盘空间。（注意在大多数情况下，使用更高级的函数 \u003ccode\u003epg_total_relation_size\u003c/code\u003e或\u003ccode\u003epg_table_size\u003c/code\u003e更方便，它们将所有分支的大小相加。）使用一个参数，这将返回关系的主数据分支的大小。第二个参数可以用来指定要检查哪个分支：\u003cpre\u003epg_relation_size ( relation regclass [, fork text ] ) → bigint\u003c/pre\u003e计算指定关系的一个\u003cspan\u003e“\u003cspan\u003e分支\u003c/span\u003e”\u003c/span\u003e所使用的磁盘空间。（注意在大多数情况下，使用更高级的函数 \u003ccode\u003epg_total_relation_size\u003c/code\u003e或\u003ccode\u003epg_table_size\u003c/code\u003e更方便，它们将所有分支的大小相加。）使用一个参数，这将返回关系的主数据分支的大小。第二个参数可以用来指定要检查哪个分支：","SourceRevision":"1b5ca64c","ContentHash":"be7fc3d425d73c77a45e96c263e0091e1954e3a6b99fe00c7c5eed9e36701629","Payload":{"description_zh":"计算指定关系的一个“分支”所使用的磁盘空间。（注意在大多数情况下，使用更高级的函数 pg_total_relation_size或pg_table_size更方便，它们将所有分支的大小相加。）使用一个参数，这将返回关系的主数据分支的大小。第二个参数可以用来指定要检查哪个分支：","description_zh_html":"计算指定关系的一个\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e分支\u003c/span\u003e”\u003c/span\u003e所使用的磁盘空间。（注意在大多数情况下，使用更高级的函数 \u003ccode class=\"function\"\u003epg_total_relation_size\u003c/code\u003e或\u003ccode class=\"function\"\u003epg_table_size\u003c/code\u003e更方便，它们将所有分支的大小相加。）使用一个参数，这将返回关系的主数据分支的大小。第二个参数可以用来指定要检查哪个分支：","signatures":[{"description_zh":"计算指定关系的一个“分支”所使用的磁盘空间。（注意在大多数情况下，使用更高级的函数 pg_total_relation_size或pg_table_size更方便，它们将所有分支的大小相加。）使用一个参数，这将返回关系的主数据分支的大小。第二个参数可以用来指定要检查哪个分支：","description_zh_html":"计算指定关系的一个\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e分支\u003c/span\u003e”\u003c/span\u003e所使用的磁盘空间。（注意在大多数情况下，使用更高级的函数 \u003ccode class=\"function\"\u003epg_total_relation_size\u003c/code\u003e或\u003ccode class=\"function\"\u003epg_table_size\u003c/code\u003e更方便，它们将所有分支的大小相加。）使用一个参数，这将返回关系的主数据分支的大小。第二个参数可以用来指定要检查哪个分支：","returns":"bigint","text":"pg_relation_size ( relation regclass [, fork text ] ) → bigint","zh_from":"doc"}],"zh_from":"doc"}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":[{"Version":"18","Ordinal":0,"Hash":"940c2f5fa3929e0286ba28340e8aa64bf2fe4ee21d7388aceddcdb7dfb59dce3","Text":"pg_relation_size ( relation regclass [, fork text ] ) → bigint","Returns":"bigint","Payload":{"description":"Computes the disk space used by one “fork” of the specified relation. (Note that for most purposes it is more convenient to use the higher-level functions pg_total_relation_size or pg_table_size, which sum the sizes of all forks.) With one argument, this returns the size of the main data fork of the relation. The second argument can be provided to specify which fork to examine:","description_html":"Computes the disk space used by one \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003efork\u003c/span\u003e”\u003c/span\u003e of the specified relation. (Note that for most purposes it is more convenient to use the higher-level functions \u003ccode class=\"function\"\u003epg_total_relation_size\u003c/code\u003e or \u003ccode class=\"function\"\u003epg_table_size\u003c/code\u003e, which sum the sizes of all forks.) With one argument, this returns the size of the main data fork of the relation. The second argument can be provided to specify which fork to examine:","description_zh":"","description_zh_html":"","examples":[],"html":"\u003ccode class=\"function\"\u003epg_relation_size\u003c/code\u003e ( \u003cem class=\"parameter\"\u003e\u003ccode\u003erelation\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003eregclass\u003c/code\u003e [\u003cspan class=\"optional\"\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003efork\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e\u003c/span\u003e ] ) → \u003ccode class=\"returnvalue\"\u003ebigint\u003c/code\u003e","returns":"bigint","text":"pg_relation_size ( relation regclass [, fork text ] ) → bigint","zh_from":""}}],"Spellings":null,"SQLState":null,"Evidence":null}
