Maybe my thinking is just missing something obvious here. But looking
at a fresh initdb, I'm seeing a number of files in the data directory
for this database that don't have corresponding entries in pg_class. I
looked for entries based on relfilenode in pg_class - am I missing
some other way we put files in there?
I'm seeing the same on both head and 9.1 as an example, but different oids.
I feel I'm either missing something obvious, or we have a problem
here? And somehow the first one seems more likely..
The query I ran (yeah, i'm sure it can be written prettier, but this
was quick-n-dirty):
with t as ( select * from pg_ls_dir('<datadir>/base/1') l(f) where f not in ( select relfilenode::text from
pg_class union all select relfilenode::text || '_vm' from pg_class union all select relfilenode::text ||
'_fsm'from pg_class)
)
select f, size, modification
from t, pg_stat_file('<datadir>/base/1/' || f)
order by 1;
Which gives me: f | size | modification
-----------------+--------+------------------------11809 | 65536 | 2013-04-01 20:34:45+0211809_fsm |
24576| 2013-04-01 20:34:45+0211809_vm | 8192 | 2013-04-01 20:34:45+0211811 | 16384 | 2013-04-01
20:34:45+0211812 | 32768 | 2013-04-01 20:34:45+0211821 | 344064 | 2013-04-01 20:34:45+0211821_fsm
| 24576 | 2013-04-01 20:34:45+0211821_vm | 8192 | 2013-04-01 20:34:45+0211823 | 131072 |
2013-04-0120:34:45+0211824 | 90112 | 2013-04-01 20:34:45+0211825 | 507904 | 2013-04-01
20:34:45+0211825_fsm | 24576 | 2013-04-01 20:34:45+0211825_vm | 8192 | 2013-04-01 20:34:45+0211827
| 0 | 2013-04-01 20:34:45+0211829 | 8192 | 2013-04-01 20:34:45+0211830 | 73728 |
2013-04-0120:34:45+0211831 | 196608 | 2013-04-01 20:34:45+0211832 | 65536 | 2013-04-01
20:34:45+0211832_fsm | 24576 | 2013-04-01 20:34:45+0211832_vm | 8192 | 2013-04-01 20:34:45+0211834
| 16384 | 2013-04-01 20:34:45+0211835 | 32768 | 2013-04-01 20:34:45+02pg_filenode.map | 512 |
2013-04-0120:34:45+02PG_VERSION | 4 | 2013-04-01 20:34:44+02
(24 rows)
The filenode map and pg_version obviously make sense, but where are
the others from?
-- Magnus HaganderMe: http://www.hagander.net/Work: http://www.redpill-linpro.com/