pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
[Admin] Deleting Orphan Relfilenode
2+ messages / 2 participants
[nested] [flat]

* [Admin] Deleting Orphan Relfilenode
@ 2018-07-16 12:10 Rahul Saha <rahul.blooming@gmail.com>
  2018-07-16 15:18 ` Re: [Admin] Deleting Orphan Relfilenode Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: Rahul Saha @ 2018-07-16 12:10 UTC (permalink / raw)
  To: pgsql-admin

Hi Experts,

Background - PG version 9.4
Running in Linux Rhel

We have a scenario where we ran Vacuum Full (2 TB Table)but due to some reason Vacuum Full failed. 

These have let almost 1 TB orphan Relfilenodes inside base directory under the concern database which does not map with pg_class. 

For example - Select * from pg_class where relfilenode = 123456. It does not return any row but those relfilenode exist inside base. 

It would be great if you can suggest how to remove those orphan files. I know definitely manually deleting is not suggested so thought to know your suggestions. 

Kind Regards,
Rahul Saha





^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [Admin] Deleting Orphan Relfilenode
  2018-07-16 12:10 [Admin] Deleting Orphan Relfilenode Rahul Saha <rahul.blooming@gmail.com>
@ 2018-07-16 15:18 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2018-07-16 15:18 UTC (permalink / raw)
  To: Rahul Saha <rahul.blooming@gmail.com>; +Cc: pgsql-admin

Rahul Saha <rahul.blooming@gmail.com> writes:
> We have a scenario where we ran Vacuum Full (2 TB Table)but due to some reason Vacuum Full failed. 
> These have let almost 1 TB orphan Relfilenodes inside base directory under the concern database which does not map with pg_class. 

Hm, by "fail" do you mean a database crash?  Ordinary errors should have
rolled back the file creation successfully.

> For example - Select * from pg_class where relfilenode = 123456. It does not return any row but those relfilenode exist inside base. 

I would not trust that query if I were you --- it will not find mapped
system catalogs.  Maybe you are certain that this orphaned file wasn't
for a system catalog, but I'd still recommend using

select * from pg_class where pg_relation_filenode(oid) = 123456;

to be sure.  (See also contrib/oid2name.)

> It would be great if you can suggest how to remove those orphan files. I know definitely manually deleting is not suggested so thought to know your suggestions. 

If they're really orphaned, as proven by a pg_relation_filenode() check,
then manual "rm" is the thing to do.  Postgres doesn't know they are
there and will not remove them.

			regards, tom lane




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2018-07-16 15:18 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-07-16 12:10 [Admin] Deleting Orphan Relfilenode Rahul Saha <rahul.blooming@gmail.com>
2018-07-16 15:18 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox