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

Started by Bruce Momjianabout 23 years ago2 messagesgeneral
Jump to latest
#1Bruce Momjian
bruce@momjian.us

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

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#1)
Re: file in data doesn't correspond to any oid in pg_class?

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