Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eV6YJ-0006PO-TV for pgsql-general@arkaria.postgresql.org; Sat, 30 Dec 2017 02:07:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eV6YJ-0003pP-Bg for pgsql-general@arkaria.postgresql.org; Sat, 30 Dec 2017 02:07:11 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eV6YJ-0003pG-0u for pgsql-general@lists.postgresql.org; Sat, 30 Dec 2017 02:07:11 +0000 Received: from tamriel.snowman.net ([96.255.250.162]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1eV6YG-0002cH-9q for pgsql-general@lists.postgresql.org; Sat, 30 Dec 2017 02:07:09 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 096965F79C; Fri, 29 Dec 2017 21:07:06 -0500 (EST) Date: Fri, 29 Dec 2017 21:07:06 -0500 From: Stephen Frost To: Melvin Davidson Cc: Edson Carlos Ericksson Richter , pgsql-general@lists.postgresql.org Subject: Re: Does PostgreSQL check database integrity at startup? Message-ID: <20171230020706.GD2416@tamriel.snowman.net> References: <20171227213314.GY4628@tamriel.snowman.net> <20171227215204.nucxo7b2ssmyznip@alvherre.pgsql> <20171228121651.GZ4628@tamriel.snowman.net> <42cda197-fead-a7e5-a7e2-750d98bc4eb2@simkorp.com.br> <743808611.5608368.1514484408822@mail.yahoo.com> <20171228182636.GG4628@tamriel.snowman.net> <48a4bcfa-6b85-81ca-9b59-9e47af8fa5af@simkorp.com.br> <20171230011315.GC2416@tamriel.snowman.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="k4f25fnPtRuIRUb3" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --k4f25fnPtRuIRUb3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Greetings, * Melvin Davidson (melvin6925@gmail.com) wrote: > >There should be a "catalog" that point where tables are stored in physic= al > files... >=20 > Here is the query that gives you that information. >=20 > SELECT c.oid, > n.nspname as schema, > c.relname as table, > (SELECT oid FROM pg_database WHERE datname =3D > current_database() ) as db_dir, > c.relfilenode as filename > FROM pg_class c > JOIN pg_namespace n ON (n.oid =3D c.relnamespace) > WHERE relname NOT LIKE 'pg_%' > AND relname NOT LIKE 'information%' > AND relname NOT LIKE 'sql_%' > AND relkind =3D '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 --k4f25fnPtRuIRUb3 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJaRvTKAAoJEO1sijiDR2RVVF0P/A4+wrUZeRA5QrKVLoNQ9a8W 21qbkUFg/7CjEevB80TFMx5T+iWjlgGQDozgu9uUVJJAbq0UvL/zlpUyGJz4WZvb K6mL1cqUNXbfdef26MvpRT77sNoBP6SYRljedONavDYeWCSGVZgwN9MSGQjnx+w0 i58jaMEqlJ5OZbhIgpCG1/oI/o6qi4ukq4dN0WLmEP+rweG8Qkf8CZP4nCgdeD6n 3lJTITETA77WbAEjdSO2OoK6xdzsH0YXM+DAnmNiI2AjHX1xszxUXhyPQxq1kX0A Atv0eoh4a2oMszAx3dnSJQ/CBcoYLkrASWaYPR7+LdUDPxtCOH3Iq9f3M4B1xHZs 8PyJcEEdbU3af11MXUwAAzI9KJEcYNfKyTRwD5yYQlLELaOC/kVXfIzNlOOlF6Nc fSHEfzsaHpvGbYy3aBoi1/o6RAWSSAbp6ZmUcqdZdIzfmIM8TxTq6pja+wSqFdIh /38dddcFSvd50oD/ccVtfOsmW3v/3HphC97guteAzxUarM3ZhlxAAs4l/7wFZcJI e4yOsImm0OMuio9TJEgVFfASfy9HmzWEnaSHITGbmxmeYhoVsSiA5jgNPR46OVIp +DsPG2WkKfHLas3FIwULqBPB5h3qA5FJPQXbAt+1axyZooXNrTSwgY5Yg6mi+xNM NJd0hnw3crYS5L/+dO7U =qAkV -----END PGP SIGNATURE----- --k4f25fnPtRuIRUb3--