pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Martin Mueller <martinmueller@northwestern.edu>
To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: metadata about creation and size of tables
Date: Tue, 2 Oct 2018 14:41:16 -0700
Message-ID: <b2c1bc92-b29d-0e82-00e4-da29ec22d83f@aklaver.com> (raw)
In-Reply-To: <E6E0C150-E1A4-44BC-99E0-12395DEE6BE3@northwestern.edu>
References: <E6E0C150-E1A4-44BC-99E0-12395DEE6BE3@northwestern.edu>

On 10/2/18 1:38 PM, Martin Mueller wrote:
> I’ve looked at the documentation to find where to find some data that 
> are very to find Mysql:  the creation and modification data of a table 
> and the size of particular tables.
> 
> Where do I find an answer to the question “which is the last table I 
> created” or “when did I last modify this table?”  In the data directory, 

Postgres does not track these times. You can search the list archives 
for past discussions on the pros and cons.

> tables seem to have numbers, but there doesn’t seem to be an easy 
> mapping of those numbers to the table names.
From:

https://www.postgresql.org/docs/10/static/functions-admin.html#FUNCTIONS-ADMIN-DBOBJECT

select pg_relation_filepath('id_test'), pg_relation_filenode('id_test');
  pg_relation_filepath | pg_relation_filenode 
 
 

----------------------+---------------------- 
 
 

  base/733941/2976140  |              2976140

> 
> I thumbed through the documentation, but didn’t see any heading that was 
> likely to have that information.  Is there some where  a “table of 
> tables” that lets you look up various metadata?

https://www.postgresql.org/docs/10/static/catalogs.html

For tables in particular:

https://www.postgresql.org/docs/10/static/catalog-pg-class.html

There is also:

https://www.postgresql.org/docs/10/static/information-schema.html


And in psql there are the \ commands:

https://www.postgresql.org/docs/10/static/app-psql.html

In psql \? will get you a list of these with descriptions

As an example:

test_(aklaver)> \d id_test
                                  Table "public.id_test"
  Column |       Type        | Collation | Nullable | 
Default
--------+-------------------+-----------+----------+-------------------------------------
  id     | integer           |           | not null | 
nextval('id_test_id_seq'::regclass)
  fld_1  | character varying |           |          |
  fld_2  | boolean           |           |          |

test_(aklaver)> \d+ id_test
                                                      Table "public.id_test"
  Column |       Type        | Collation | Nullable | 
Default               | Storage  | Stats target | Description
--------+-------------------+-----------+----------+-------------------------------------+----------+--------------+-------------
  id     | integer           |           | not null | 
nextval('id_test_id_seq'::regclass) | plain    |              |
  fld_1  | character varying |           |          | 
                  | extended |              |
  fld_2  | boolean           |           |          | 
                  | plain    |              |



-- 
Adrian Klaver
adrian.klaver@aklaver.com




view thread (2+ messages)

Message-ID: <b2c1bc92-b29d-0e82-00e4-da29ec22d83f@aklaver.com>
Permalink:  ../b2c1bc92-b29d-0e82-00e4-da29ec22d83f@aklaver.com/
Also on:    postgresql.org/message-id/b2c1bc92-b29d-0e82-00e4-da29ec22d83f@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, martinmueller@northwestern.edu
  Subject: Re: metadata about creation and size of tables
  In-Reply-To: <b2c1bc92-b29d-0e82-00e4-da29ec22d83f@aklaver.com>
  References: <E6E0C150-E1A4-44BC-99E0-12395DEE6BE3@northwestern.edu> <b2c1bc92-b29d-0e82-00e4-da29ec22d83f@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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