pg_查看表的创建时间

这个表的创建时间是Dec 18

 

[postgres:5603@eimta] [04-02.11:30:31]=# \dcompany

                               Table "public.company"

Column|        Type         |                     Modifiers                      

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

id    |integer              | not null default nextval('company_id_seq'::regclass)

name   |character varying(32) | not null

age   |integer              |

Indexes:

   "company_pkey" PRIMARY KEY, btree (id)

 

[postgres:5603@postgres] [04-02.11:17:09]=# \ceimta

You are now connectedto database "eimta" as user "postgres".

[postgres:5603@eimta] [04-02.11:17:16]=# selectrelname,relfilenode,reltablespace from pg_class where relname='company';

relname | relfilenode| reltablespace

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

company|       17632|             0

(1 row)

 

Time: 12.704 ms

 

表 company 的 reltablespace值为 0,表示位于所属数据库的默认表空间

[postgres:5603@eimta] [04-02.11:17:19]=# \dt+company

                    List of relations

Schema | Name   | Type  |   Owner   | Size  |Description

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

public | company |table | eimtadata | 16 kB |

(1 row)

 

 

Time: 0.836 ms

 

[postgres:5603@eimta] [04-02.11:18:18]=# selectoid,datname,dattablespace from pg_database where datname='eimta';

  oid  |datname | dattablespace

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

17532 |eimta   |          1663

(1 row)

 

Time: 0.431 ms

 

数据库的oid 为 17532

 

[postgres:5603@eimta] [04-02.11:19:18]=# selectoid,* from pg_tablespace where oid=1663;

oid  | spcname   | spcowner | spcacl | spcoptions

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

1663 | pg_default|       10|        |

(1 row)

 

[postgres@cnsz081771:eimta:5603/paic/pg5603/data/base]$ ls

1  13268 13269  16745  16746  17532

 

 

 

[postgres:5603@eimta] [04-02.11:20:04]=# \db

      List of tablespaces

   Name    |  Owner   | Location

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

pg_default | postgres|

 pg_global | postgres |

 

 

[postgres@cnsz081771:eimta:5603/paic/pg5603/data/base/17532]$ ll 17632

-rw------- 1 postgrespostgres 8192 Dec 18 11:50 17632

你可能感兴趣的:(postgres)