PostgreSQL应用相关问题解决
PostgreSQL中是否区分聚簇索引与非聚簇索引的问题?
答:PostgreSQL中区分聚簇索引与非聚簇索引。
示例如下:
创建聚族索引:
CREATE INDEX test_ind
ON yy (name ASC NULLS LAST);
ALTER TABLE yy
CLUSTER ON test_ind;
创建非聚族索引:
CREATE INDEX test_uncluster_index
ON yy (name ASC NULLS LAST);
临时表被删除,临时表的索引是否也被删除?
答:临时表被删除,临时表的索引也同时被删除。
示例如下:
创建两个临时表:
test1=# create temporary table tmp_t1(id int primary key,note text);
CREATE TABLE
test1=# \dt
List of relations
Schema | Name | Type | Owner
----------------------+---------
pg_temp_2 | tmp_t1 | table | postgres
public | student | table | postgres
public | testdb | table | postgres
(3 rows)
test1=# create temporary table tmp_t2(id int primary key,name char(10),note
text);
CREATE TABLE
test1=# \dt
List of relations
Schema | Name | Type | Owner
----------------------+---------
pg_temp_2 | tmp_t1 | table | postgres
pg_temp_2 | tmp_t2 | table | postgres
public | student | table | postgres
public | testdb | table | postgres
(4 rows)
给两个临时表分别创建索引并查看索引:
test1=# create index idx_tmp_t1_id on tmp_t1(id);
CREATE INDEX
test1=# create index idx_tmp_t2_id on tmp_t2(id);
CREATE INDEX
test1=# \di
List of relations
Schema | Name | Type | Owner | Table
-------------------------------------------
pg_temp_2 | idx_tmp_t1_id | index | postgres | tmp_t1
pg_temp_2 | idx_tmp_t2_id | index | postgres | tmp_t2
pg_temp_2 | tmp_t1_pkey | index | postgres | tmp_t1
pg_temp_2 | tmp_t2_pkey | index | postgres | tmp_t2
(4 rows)
删除临时表1:
test1=# drop table tmp_t1;
DROP TABLE
test1=# \dt
List of relations
Schema | Name | Type | Owner
----------------------+---------
pg_temp_2 | tmp_t2 | table | postgres
public | student | table | postgres
public | testdb | table | postgres
(3 rows)
查看索引,临时表1的索引也被删除:
test1=# \di
List of relations
Schema | Name | Type | Owner | Table
-------------------------------------------
pg_temp_2 | idx_tmp_t2_id | index | postgres | tmp_t2
pg_temp_2 | tmp_t2_pkey | index | postgres | tmp_t2
(2 rows)
PostgreSQL应用相关问题解决的更多相关文章
- Hadoop相关问题解决
Hadoop相关问题解决 Hive 1.查询hivemeta信息,查到的numRows为-1 集群厂商 集群版本 是否高可用 是否开启认证 cdh 不限 不限 不限 在hivemeta库中可以通过以下 ...
- 线下AWD平台搭建以及一些相关问题解决
线下AWD平台搭建以及一些相关问题解决 一.前言 文章首发于tools,因为发现了一些新问题但是没法改,所以在博客进行补充. 因为很多人可能没有机会参加线下的AWD比赛,导致缺乏这方面经验,比如我参加 ...
- CTFd平台搭建以及一些相关问题解决
CTFd平台搭建以及一些相关问题解决 一.序言 因为想给学校工作室提高一下学习氛围,随便带学弟学妹入门,所以做了一个ctf平台,开源的平台有CTFd和FBCTF,因为学生租不起高端云主机所以只能选择占 ...
- Ubuntu 17.10安装VirtualBox 5.2.2 及相关问题解决
link:https://www.linuxidc.com/Linux/2017-11/148870.htm sudo apt update && sudo apt upgrade s ...
- 常用SQL操作(MySQL或PostgreSQL)与相关数据库概念
本文对常用数据库操作及相关基本概念进行总结:MySQL和PostgreSQL对SQL的支持有所不同,大部分SQL操作还是一样的. 选择要用的数据库(MySQL):use database_name; ...
- 安装 SQL Server 2008 和管理工具 SQL Server 2008 management studio 及相关问题解决
Sql Server 2008 问题小总结 http://www.lihengyu.com/blog/4877.html 安装 SQL Server 2008 和管理工具 SQL Server 200 ...
- Postgresql 日志相关
目录日志种类作用总结配置文件中与日志相关的配置日志种类 PostgreSQL有3种日志 pg_log(数据库运行日志) 内容可读 默认关闭的,需要设置参数启动pg_xlog(WAL 日志,即 ...
- 安装cocoapods及相关问题解决
申明:本博客大部分内容转载自简书http://www.jianshu.com/p/b64b4fd08d3c,但还有些问题博主在这里做了补充. Mac系统版本:10.12.1 一.什么是CocoaPod ...
- CocoaPods安装以及相关问题解决
Mac OS X上安装 Ruby环境 安装RVM $ curl -L https://get.rvm.io | bash -s stable 关闭终端,新开另外一个终端(新打开的终端会自动载入RVM环 ...
随机推荐
- Bootstrap页面布局22 - BS工具提示
当鼠标点击在一个a连接上时,显示提示文字的效果 ---------------- tooltip <div class='container-fluid'> <h3 class=' ...
- VSS 访问问题
局域网同一网段的2台电脑,防火墙都是关闭的 A能ping通B 但A在运行输入B的IP地址 不能访问 求解答 1.确认输入的地址格式没有写错,例如B的IP地址为:192.168.1.20.那么在A电脑的 ...
- coursera-miniproject Pang任务总结
Mini_project开发过程 1.通过添加代码画出一个在乒乓球台移动的球.我们提醒你给乒乓台添加位置信息给draw handler像在”Motion"那节课第二部分介绍的那样 2.添加代 ...
- 灰度图像 Grayscale Binary_image
https://en.wikipedia.org/wiki/Grayscale https://zh.wikipedia.org/wiki/灰度图像 In photography and comput ...
- 【转】const 是左结合的,若左边为空,则再向右结合
const 是左结合的,若左边为空,则再向右结合 一.指向 const 对象的指针指向 const 对象的指针,指的是指针指向的对象的内容是const的,不可修改,但指针本身(即指针的值)是可 ...
- Visual Studio 2010扩展让JS与CSS实现折叠
在Visaul Studio 2010中写js或css代码,缺少像写C#代码时的那种折叠功能,当代码比较多时,就很不方便. 今天发现,已经有VS2010扩展支持这个功能,它就是——JSEnhancem ...
- BAT for循环
一,数字循环 echo off & color 0A for /l %%i in (1,1,10) do ( echo %%i ) pause > nul 输出: 1 2 3 4 5 6 ...
- Magento - Rewrite机制一窥
看一个url例子 http://localhost/magento/index.php/customer/account/login 这里假定http://localhost/magento/ 是ma ...
- 折腾Centos6.4记
背景: 闲置了一台Thinkpad,之前装的是Kali Linux,但无线网卡挂掉了,加之硬盘分区不当,平时几乎没怎么用,重新使用kali的livecd进行分区,然后安装,总是出错,尝试了七八次,仍然 ...
- Xcode 自定义代码段
看见老师敲程序时,快捷键一打,所需要的一整行代码都出来了,着实感觉到效率太高了. 看了几天,才反应过来为什么自己没有get这个方法呢,现在就整理一番,记录一下. 此处以@property(nonato ...