summaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorRobert Haas2022-09-27 17:25:21 +0000
committerRobert Haas2022-09-27 17:25:21 +0000
commit05d4cbf9b6ba708858984b01ca0fc56d59d4ec7c (patch)
tree645e3ac17f002ae33e086dbf871c330986452c35 /doc/src
parent2f47715cc8649f854b1df28dfc338af9801db217 (diff)
Increase width of RelFileNumbers from 32 bits to 56 bits.
RelFileNumbers are now assigned using a separate counter, instead of being assigned from the OID counter. This counter never wraps around: if all 2^56 possible RelFileNumbers are used, an internal error occurs. As the cluster is limited to 2^64 total bytes of WAL, this limitation should not cause a problem in practice. If the counter were 64 bits wide rather than 56 bits wide, we would need to increase the width of the BufferTag, which might adversely impact buffer lookup performance. Also, this lets us use bigint for pg_class.relfilenode and other places where these values are exposed at the SQL level without worrying about overflow. This should remove the need to keep "tombstone" files around until the next checkpoint when relations are removed. We do that to keep RelFileNumbers from being recycled, but now that won't happen anyway. However, this patch doesn't actually change anything in this area; it just makes it possible for a future patch to do so. Dilip Kumar, based on an idea from Andres Freund, who also reviewed some earlier versions of the patch. Further review and some wordsmithing by me. Also reviewed at various points by Ashutosh Sharma, Vignesh C, Amul Sul, Álvaro Herrera, and Tom Lane. Discussion: http://postgr.es/m/CA+Tgmobp7+7kmi4gkq7Y+4AM9fTvL+O1oQ4-5gFTT+6Ng-dQ=g@mail.gmail.com
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/catalogs.sgml2
-rw-r--r--doc/src/sgml/func.sgml5
-rw-r--r--doc/src/sgml/pgbuffercache.sgml2
-rw-r--r--doc/src/sgml/storage.sgml11
4 files changed, 13 insertions, 7 deletions
diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 00f833d210e..40d4e9c35e6 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -1984,7 +1984,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
<row>
<entry role="catalog_table_entry"><para role="column_definition">
- <structfield>relfilenode</structfield> <type>oid</type>
+ <structfield>relfilenode</structfield> <type>int8</type>
</para>
<para>
Name of the on-disk file of this relation; zero means this
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 546213fa931..d8718ed61e6 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -25210,6 +25210,11 @@ SELECT collation for ('foo' COLLATE "de_DE");
<entry><type>timestamp with time zone</type></entry>
</row>
+ <row>
+ <entry><structfield>next_relfilenumber</structfield></entry>
+ <entry><type>timestamp with time zone</type></entry>
+ </row>
+
</tbody>
</tgroup>
</table>
diff --git a/doc/src/sgml/pgbuffercache.sgml b/doc/src/sgml/pgbuffercache.sgml
index a06fd3e26de..e2222655804 100644
--- a/doc/src/sgml/pgbuffercache.sgml
+++ b/doc/src/sgml/pgbuffercache.sgml
@@ -62,7 +62,7 @@
<row>
<entry role="catalog_table_entry"><para role="column_definition">
- <structfield>relfilenode</structfield> <type>oid</type>
+ <structfield>relfilenode</structfield> <type>int8</type>
(references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relfilenode</structfield>)
</para>
<para>
diff --git a/doc/src/sgml/storage.sgml b/doc/src/sgml/storage.sgml
index e5b9f3f1ffa..d9e9b0f43ee 100644
--- a/doc/src/sgml/storage.sgml
+++ b/doc/src/sgml/storage.sgml
@@ -217,11 +217,12 @@ with the suffix <literal>_init</literal> (see <xref linkend="storage-init"/>).
<caution>
<para>
-Note that while a table's filenode often matches its OID, this is
-<emphasis>not</emphasis> necessarily the case; some operations, like
-<command>TRUNCATE</command>, <command>REINDEX</command>, <command>CLUSTER</command> and some forms
-of <command>ALTER TABLE</command>, can change the filenode while preserving the OID.
-Avoid assuming that filenode and table OID are the same.
+Note that a table's filenode will normally be different than the OID. For
+system tables, the initial filenode will be equal to the table OID, but it will
+be different if the table has ever been subjected to a rewriting operation,
+such as <command>TRUNCATE</command>, <command>REINDEX</command>,
+<command>CLUSTER</command> or some forms of <command>ALTER TABLE</command>.
+For user tables, even the initial filenode will be different than the table OID.
Also, for certain system catalogs including <structname>pg_class</structname> itself,
<structname>pg_class</structname>.<structfield>relfilenode</structfield> contains zero. The
actual filenode number of these catalogs is stored in a lower-level data