Re: Does PostgreSQL check database integrity at startup?

From: Melvin Davidson <melvin6925(at)gmail(dot)com>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: Edson Carlos Ericksson Richter <richter(at)simkorp(dot)com(dot)br>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Does PostgreSQL check database integrity at startup?
Date: 2017-12-30 02:14:22
Message-ID: CANu8FizkQcod6277BV-0ON7OdXdK95dNhR=68-0V9jG-mNz_wA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Dec 29, 2017 at 9:07 PM, Stephen Frost <sfrost(at)snowman(dot)net> wrote:

> Greetings,
>
> * Melvin Davidson (melvin6925(at)gmail(dot)com) wrote:
> > >There should be a "catalog" that point where tables are stored in
> physical
> > files...
> >
> > Here is the query that gives you that information.
> >
> > SELECT c.oid,
> > n.nspname as schema,
> > c.relname as table,
> > (SELECT oid FROM pg_database WHERE datname =
> > current_database() ) as db_dir,
> > c.relfilenode as filename
> > FROM pg_class c
> > JOIN pg_namespace n ON (n.oid = c.relnamespace)
> > WHERE relname NOT LIKE 'pg_%'
> > AND relname NOT LIKE 'information%'
> > AND relname NOT LIKE 'sql_%'
> > AND relkind = 'r'
> > ORDER BY 2, relname;
>
> This isn't a terribly good query- it's entirely valid to have 'pg_blah'
> and 'informationblah' tables in user schemas. If you'd like to filter
> out the catalogs/internal schemas, filter based on schema name instead.
>
> Also, this doesn't actually provide what Edson is asking for. Edson's
> asking for a query that uses pg_ls_dir() or some custom function which
> will run 'stat' on each file and return the size, according to the OS.
>
> Thanks!
>
> Stephen
>

*Edson's original request was for a query that shows the FILENAMEs for the
table.*
*As for "qood" query, that is entirely an opinion. The query WILL show all
files associated*

*with ALL tables. You are free to edit and reconstruct as you choose. *

--
*Melvin Davidson*
I reserve the right to fantasize. Whether or not you
wish to share my fantasy is entirely up to you.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stephen Frost 2017-12-30 02:22:10 Re: Does PostgreSQL check database integrity at startup?
Previous Message Stephen Frost 2017-12-30 02:07:06 Re: Does PostgreSQL check database integrity at startup?