作者
digoal
日期
2019-09-08
标签
PostgreSQL , archive status dir , temp dir
背景
PostgreSQL 12 添加了两个函数,用于查询归档状态目录的内容,临时文件目录(排序、创建索引、聚合等采用的临时文件目录)。
Add the ability to list the contents of the archive directory (Christoph Moench-Tegeder)
- The function is pg_ls_archive_statusdir().
postgres=# select * from pg_ls_archive_statusdir();
name | size | modification
-------------------------------+------+------------------------
000000020000026000000057.done | 0 | 2019-09-07 23:59:21+08
(1 row)
Add the ability to list the contents of temporary directories (Nathan Bossart)
- The function, pg_ls_tmpdir(), optionally allows specification of a tablespace.
postgres=# select * from pg_ls_tmpdir();
name | size | modification
------------------+----------+------------------------
pgsql_tmp16388.1 | 59457536 | 2019-09-08 00:23:51+08
(1 row)
临时目录和表空间挂钩,所以可以指定表空间,查看某个表空间的临时目录。
```
postgres=# show temp_tablespaces ;
temp_tablespaces
(1 row)
空表示采用当前数据库的默认表空间。
postgres=# \df pg_ls_tmpdir
List of functions
Schema | Name | Result data type | Argument data types | Type
------------+--------------+------------------+-------------------------------------------------------------------------------------------+------
pg_catalog | pg_ls_tmpdir | SETOF record | OUT name text, OUT size bigint, OUT modification timestamp with time zone | func
pg_catalog | pg_ls_tmpdir | SETOF record | tablespace oid, OUT name text, OUT size bigint, OUT modification timestamp with time zone | func
(2 rows)
```
PostgreSQL 许愿链接
您的愿望将传达给PG kernel hacker、数据库厂商等, 帮助提高数据库产品质量和功能, 说不定下一个PG版本就有您提出的功能点. 针对非常好的提议,奖励限量版PG文化衫、纪念品、贴纸、PG热门书籍等,奖品丰富,快来许愿。开不开森.