PostgreSQL: Query for location of global tablespace?
Q:
I have been trying to make our database clients pro-active about not filling up the partition on which the database they are using resides.
adb=> select * from pg_tablespace; spcname | spcowner | spclocation | spcacl
------------+----------+-------------------+---------------------
pg_default | 10 | |
pg_global | 10 | |
adb | 2033793 | /database /adb | {adb =C/ adb}
I can't see how, from the client, to get the path to where the global tablespace is stored; an empty string is returned for it in the above query.
Unfortunately, we have many legacy systems in the field using a particular database created in the global tablespace, and it would be a monumental effort to get it moved into a user-created tablespace.
pg_default and pg_global locations are "hardcoded".
test=# select setting||'/base' from pg_settings where name='data_directory';
test=# select setting||'/global' from pg_settings where name='data_directory';
* where the data file(s) for a given database object reside on the file
* system.
*
* A tablespace represents a directory on the file system. At tablespace
* creation time, the directory must be empty. To simplify things and
* remove the possibility of having file name conflicts, we isolate
* files within a tablespace into database-specific subdirectories.
*
* To support file access via the information given in RelFileNode, we
* maintain a symbolic-link map in $PGDATA/pg_tblspc. The symlinks are
* named by tablespace OIDs and point to the actual tablespace directories.
* There is also a per-cluster version directory in each tablespace.
* Thus the full path to an arbitrary file is
* $PGDATA/pg_tblspc/spcoid/PG_MAJORVER_CATVER/dboid/relfilenode
* e.g.
* $PGDATA/pg_tblspc/20981/PG_9.0_201002161/719849/83292814
*
* There are two tablespaces created at initdb time: pg_global (for shared
* tables) and pg_default (for everything else). For backwards compatibility
* and to remain functional on platforms without symlinks, these tablespaces
* are accessed specially: they are respectively
* $PGDATA/global/relfilenode
* $PGDATA/base/dboid/relfilenode
*
* To allow CREATE DATABASE to give a new database a default tablespace
* that's different from the template database's default, we make the
* provision that a zero in pg_class.reltablespace means the database's
* default tablespace. Without this, CREATE DATABASE would have to go in
* and munge the system catalogs of the new database.
*
PostgreSQL: Query for location of global tablespace?的更多相关文章
- Distributed PostgreSQL on a Google Spanner Architecture – Query Layer
转自:https://blog.yugabyte.com/distributed-postgresql-on-a-google-spanner-architecture-query-layer/ Ou ...
- Lost connection to MySQL server during query,MySQL设置session,global变量及网络IO与索引
Navicat导出百万级数据时,报错:2013 - Lost connection to MySQL server during query 网上一番搜索,修改mysql如下几处配置文件即可: sel ...
- 在PostgreSQL中 pg_start_backup 做了什么?
# 在PostgreSQL中 pg_start_backup 做了什么?HM 2019-07-30 ## pg_start_backup 做一个备份开始标记,还做了一些其他的操作,下面进行探寻. * ...
- Reading query string values in JavaScript
时间 2016-01-23 13:01:14 CrocoDillon’s Blog 原文 http://crocodillon.com/blog/reading-query-string-valu ...
- 通过Javascript得到URL中的参数(query string)
我们知道,"GET"请求中,通常把参数放在URL后面,比如这样http://www.cnblogs.com/season-huang/index?param=yes&art ...
- PostgreSQL相关的软件,库,工具和资源集合
PostgreSQL相关的软件,库,工具和资源集合. 备份 wal-e - Simple Continuous Archiving for Postgres to S3, Azure, or Swif ...
- mysql状态分析之show global status(转)
mysql> show global status;可以列出MySQL服务器运行各种状态值,我个人较喜欢的用法是show status like '查询值%';一.慢查询mysql> sh ...
- show global status和show variables mysql 优化
mysql> show global status; 可以列出MySQL服务器运行各种状态值,我个人较喜欢的用法是show status like '查询值%'; 一.慢查询 mysql> ...
- (转)通过Javascript得到URL中的参数(query string)
原文地址:http://www.cnblogs.com/season-huang/p/3322561.html 我们知道,"GET"请求中,通常把参数放在URL后面,比如这样htt ...
随机推荐
- 自适应label的高度
iOS7以下的系统可使用方法 //获得当前cell高度 CGRect frame = [self frame]; //文本赋值 self.introduction.text = text; //设置l ...
- 0911 Socket网络编程
1.实现ftp上传.下载功能 1.1 循环接收数据直到接收完毕 server端接收client发送的命令(比如说ifconfig),然后server端将命令执行结果反馈给客户端,这时候有个问题,ser ...
- 使用struts2的<s>标签出错
15:org.apache.struts2.views.jsp.ActionTag 16:JSP 17:18:19:executeResult Server: Resin/3.1.4a Content ...
- JQuery源码分析(五)
分离构造器 通过new 操作符构建一个对象,一般经过四部: A.创建一个新对象 B.将构造函数的作用域赋给新对象(所以this就指向了这个新对象) C.执行构造函数中的代码 D.返回这 ...
- Divisors_组合数因子个数
Description Your task in this problem is to determine the number of divisors of Cnk. Just for fun -- ...
- FATE_完全背包
ps:原来用新浪,可是代码的排版不是很好,所以用博客园啦,先容许我把从八月份开始的代码搬过来,从这里重新出发,希望这里可以一直见证我的成长. Time Limit: 2000/1000 MS (Jav ...
- DirectX 文本绘制
在Direct中进行文本绘制,可以通过Win32程序框架实现,也可以通过DXUT进行绘制. 基于第一篇的Win32框架入门实现非常简单,只需要添加数行代码即可.主要说需要修改的地方. #pragma ...
- highcharts 的使用实例:待写
http://www.hcharts.cn/demo/index.php 方法一:在Axis(包括xAxis和yAxis)有一个属性tickInterval,number类型,表示间隔,也就是间隔多少 ...
- javascript(脚本语言)
javascript(脚本语言)一.注释语法:1.单行注释 //注释内容2.多行注释 /*注释内容*/二.输出语法js语言格式,尽量靠下写,属双标签<script type=”text/java ...
- threeSum_0
//找出数组中三个数相加为0,返回存在的组数 //输入指正*A,长度为size,返回*B和长度num int threeSum_0(int *A,int size,int *B,int &nu ...