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 ...
随机推荐
- 在windows 、linux下读取目录下所有文件名
Windows要引入的头文件是<Windows.h> 主要是两个函数FindFirstFile.FindNextFile MSDN里是这么说的: FindFirstFile functio ...
- 深入分析:Fragment与Activity交互的几种方式(三,使用接口)
第一步:我们需要在Fragment中定一个接口,并确保我们的容器Activity实现了此接口: public interface onTestListener { public void onTest ...
- Ubuntu 环境变量及 ADB 配置
Ubuntu Linux 环境变量 同Windows一样,Ubuntu Linux系统包含两类环境变量:系统环境变量和用户环境变量.系统环境变量对所有系统用户都有效,用户环境变量仅仅对当前的用户有效. ...
- WPF中ListView如何改变选中条背景颜色
先上图 解决方法: <ListView ...> <ListView.ItemContainerStyle> <Style TargetType="{x:Typ ...
- i++为什么没有自增探析——JVM中i++的实现(转)
很多朋友在使用Java时候会发现一个很奇怪的现象. 那就是使用下列的短句时会发现i没有自增,这是很让人迷惑的,因为大家印象中,虽然i++优先级较低,但是总是会自增的,这里为什么i++没有自增? i=i ...
- 跟开涛老师学shiro -- INI配置
之前章节我们已经接触过一些INI配置规则了,如果大家使用过如spring之类的IoC/DI容器的话,Shiro提供的INI配置也是非常类似的,即可以理解为是一个IoC/DI容器,但是区别在于它从一个根 ...
- Fire逃生
Description: You are trapped in a building consisting of open spaces and walls. Some places are on f ...
- 理解 %IOWAIT (%WIO)
%iowait 是 “sar -u” 等工具检查CPU使用率时显示的一个指标,在Linux上显示为 %iowait,在有的Unix版本上显示为 %wio,含义都是一样的,这个指标常常被误读,很多人把它 ...
- Scrum第一天任务认领情况
在团队项目“广商百货”的SCRUM项目中我认领的任务是对登录注册界面进行完善.具体功能还没有实现,还在学习中...
- UVA 11997 STL 优先队列
题目链接: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem ...