Thread: pg_class.relfilenode for large tables

pg_class.relfilenode for large tables

From
Luca Ferrari
Date:
Hi all,
when a table becomes large a new file on disk is created. Such file has the
name compound by the pg_class.relfilenode attribute and an incremental index.
However it seems to me this does not appears in the pg_class table. Is there
any place where this extra file appears?

As an example:

postgres@fluca:~$ ls -l /opt/database/24601/41098* -h
-rw------- 1 postgres postgres 1,0G 2007-08-20 08:48 /opt/database/24601/41098
-rw------- 1 postgres postgres 202M 2007-08-20
08:49 /opt/database/24601/41098.1


select oid, * from pg_class where relname='large';

  oid  | relname | relnamespace | reltype | relowner | relam | relfilenode |
reltablespace | relpages |  reltuples  | reltoastrelid | reltoastidxid |
relhasindex | relisshared | relkind | relnatts | relchecks | reltriggers |
relukeys | relfkeys | relrefs | relhasoids | relhaspkey | relhasrules |
relhassubclass | relfrozenxid | relacl | reloptions

-------+---------+--------------+---------+----------+-------+-------------+---------------+----------+-------------+---------------+---------------+-------------+-------------+---------+----------+-----------+-------------+----------+----------+---------+------------+------------+-------------+----------------+--------------+--------+------------
 41098 | large  |         2200 |   41099 |    16386 |     0 |       41098 |
0 |   156813 | 1.12921e+07 |             0 |             0 | f           |
f           | r       |        9 |         0 |           0 |        0 |
0 |       0 | f          | f          | f           | f              |
11412913 |        |
(1 riga)


Thanks,
Luca

Re: pg_class.relfilenode for large tables

From
Martijn van Oosterhout
Date:
On Mon, Aug 20, 2007 at 08:57:14AM +0200, Luca Ferrari wrote:
> Hi all,
> when a table becomes large a new file on disk is created. Such file has the
> name compound by the pg_class.relfilenode attribute and an incremental index.
> However it seems to me this does not appears in the pg_class table. Is there
> any place where this extra file appears?

No, it is a mechanism to deal with filesize limits of various OSes.
Files are cut so that each file is no more than one gigabyte. If the
table shrinks it will go away again. There's no reason to list it in
the database as it isn't an independant object.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Attachment