Extra files in "base" dir not seen in relfilenodes

2018-01-16 Thread Daniel Farina
I am looking at a database with a wide (~500G) divergence between the total
space expended by the database directory and the result of select
sum(pg_relation_size(oid)) from pg_class;.

I located about 280G of apparent extra space by performing an anti-join
between files on disk and files in the catalog via the pg_class.relfilenode
field.

What should I do to get rid of the data, if it is, in fact, "extra"? Is
there a reasonable bug report to file? Can I independently compute the
entire itemization of files that belong in the data directory?

The cluster was pg_upgrade'd, in link mode, a while ago, to 10.1 from 9.6.
This is not necessarily relevant, though.

Thanks,
Daniel


Re: Extra files in "base" dir not seen in relfilenodes

2018-01-16 Thread Daniel Farina
On Tue, Jan 16, 2018 at 3:04 PM Tom Lane  wrote:

> Daniel Farina  writes:
> > I am looking at a database with a wide (~500G) divergence between the
> total
> > space expended by the database directory and the result of select
> > sum(pg_relation_size(oid)) from pg_class;.
>
> Odd.
>
> > I located about 280G of apparent extra space by performing an anti-join
> > between files on disk and files in the catalog via the
> pg_class.relfilenode
> > field.
>
> Umm ... are you accounting for catalogs that have zeroes in
> pg_class.relfilenode?  It's generally better to rely on the
> pg_relation_filenode(oid) function than the raw column contents.
>

Yeah, the catalogs are not considered here (oids < 1). The oids in
question are rather high. Let me re-run the antijoin with the function
though

Indeed, same result.