Thread: file in data doesn't correspond to any oid in pg_class?

file in data doesn't correspond to any oid in pg_class?

From
Greg Stark
Date:
How do I track down what relation is stored in a given file in data? I'm
trying to clean up this database before doing an export/import and I'm stumped
trying to figure out what this 400M relation is:


bash-2.05b# ls -h -l --sort=size  | head
total 632M
-rw-------    1 postgres postgres     402M Mar  4 19:16 2514073
-rw-------    1 postgres postgres      37M Mar 23 03:25 27077
-rw-------    1 postgres postgres      33M Mar 23 03:11 27071
-rw-------    1 postgres postgres      24M Mar 25 16:34 27012
-rw-------    1 postgres postgres      20M Mar 23 03:25 2511860


db=# select * from pg_class where oid = 2514073;
 relname | relnamespace | reltype | relowner | relam | relfilenode | relpages | reltuples | reltoastrelid |
reltoastidxid| relhasindex | relisshared | relkind | relnatts | relchecks | reltriggers | relukeys | relfkeys | relrefs
|relhasoids | relhaspkey | relhasrules | relhassubclass | relacl  

---------+--------------+---------+----------+-------+-------------+----------+-----------+---------------+---------------+-------------+-------------+---------+----------+-----------+-------------+----------+----------+---------+------------+------------+-------------+----------------+--------
(0 rows)



--
greg

Re: file in data doesn't correspond to any oid in pg_class?

From
Tom Lane
Date:
Greg Stark <gsstark@mit.edu> writes:
> How do I track down what relation is stored in a given file in data?

You should be searching the relfilenode column, not the oid column.
Also, are you certain you are looking in the right database?

            regards, tom lane