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应用相关问题解决的更多相关文章

  1. Hadoop相关问题解决

    Hadoop相关问题解决 Hive 1.查询hivemeta信息,查到的numRows为-1 集群厂商 集群版本 是否高可用 是否开启认证 cdh 不限 不限 不限 在hivemeta库中可以通过以下 ...

  2. 线下AWD平台搭建以及一些相关问题解决

    线下AWD平台搭建以及一些相关问题解决 一.前言 文章首发于tools,因为发现了一些新问题但是没法改,所以在博客进行补充. 因为很多人可能没有机会参加线下的AWD比赛,导致缺乏这方面经验,比如我参加 ...

  3. CTFd平台搭建以及一些相关问题解决

    CTFd平台搭建以及一些相关问题解决 一.序言 因为想给学校工作室提高一下学习氛围,随便带学弟学妹入门,所以做了一个ctf平台,开源的平台有CTFd和FBCTF,因为学生租不起高端云主机所以只能选择占 ...

  4. Ubuntu 17.10安装VirtualBox 5.2.2 及相关问题解决

    link:https://www.linuxidc.com/Linux/2017-11/148870.htm sudo apt update && sudo apt upgrade s ...

  5. 常用SQL操作(MySQL或PostgreSQL)与相关数据库概念

    本文对常用数据库操作及相关基本概念进行总结:MySQL和PostgreSQL对SQL的支持有所不同,大部分SQL操作还是一样的. 选择要用的数据库(MySQL):use database_name; ...

  6. 安装 SQL Server 2008 和管理工具 SQL Server 2008 management studio 及相关问题解决

    Sql Server 2008 问题小总结 http://www.lihengyu.com/blog/4877.html 安装 SQL Server 2008 和管理工具 SQL Server 200 ...

  7. Postgresql 日志相关

    目录日志种类作用总结配置文件中与日志相关的配置日志种类 PostgreSQL有3种日志 pg_log(数据库运行日志)   内容可读    默认关闭的,需要设置参数启动pg_xlog(WAL 日志,即 ...

  8. 安装cocoapods及相关问题解决

    申明:本博客大部分内容转载自简书http://www.jianshu.com/p/b64b4fd08d3c,但还有些问题博主在这里做了补充. Mac系统版本:10.12.1 一.什么是CocoaPod ...

  9. CocoaPods安装以及相关问题解决

    Mac OS X上安装 Ruby环境 安装RVM $ curl -L https://get.rvm.io | bash -s stable 关闭终端,新开另外一个终端(新打开的终端会自动载入RVM环 ...

随机推荐

  1. 验证码 mewebstudio/captcha

    composer require mews/captcha https://github.com/mewebstudio/captcha

  2. w_all_checked - js -checkbox 多选、全选、submit、request

    <!doctype html> <html> <head> <meta charset="UTF-8"> </head> ...

  3. Linux下安装Xdebug

    为了调试PHP程序,安装一下xdebug. 官方网址: http://www.xdebug.org 首先下载xdebug2.1.0,在官方首页下载源代码,下载回来的文件名是:xdebug-2.1.0. ...

  4. 在XE5中 VCL空窗体的3个线程

    中午看到技术群里有人讨论, XE5一个空窗体程序就包含了3个线程, 赶忙打开XE5开了个空窗体一看, 果然如此 再打开D7和2010看了一下, 都是一个线程 这时看到有人说一个是输入法, 一个是GDI ...

  5. nrf51822-使用16位自定义UUID

    以 ble_app_uart为例 工程中创建的nus服务以及其中的两个特性值都是128位的UUID.nordic sdk中使用128位UUID的方式和标准128UUID类似,它是提供一个基准UUID, ...

  6. Visual Mingw

    Visual-MinGW 是一个专门为MinGW所设计的IDE.如果,你曾经用过VC++ 6.0这个IDE,你的第一感觉就是,Visual-MinGW和VC++ 6.0非常相似.所以,对于曾经用惯VC ...

  7. 解决Eclipse启动报错Failed to create the Java Virtual Machine

    电脑:2G内存,WIN7 32位. 启动adt-bundle-windows-x86-20140702\eclipse\eclipse.exe时,报错[Failed to create the Jav ...

  8. Asp.net Mvc4默认权限详细(下)

    前言 菜鸟去重复之Sql的问题还没有得到满意的答案.如果哪位大哥有相关的资料解释,能够分享给我,那就太谢谢了. 以后每发表一篇博文我都会将以前遗留的问题在前言里指出,直到解决为止. 本文主要在于探讨一 ...

  9. Naming Conventions for .NET / C# Projects

    http://www.akadia.com/services/naming_conventions.html Naming Conventions for .NET / C# Projects Mar ...

  10. iOS Node Conflict svn冲突

    当出现这个冲突时,应该是我add的文件,和同事处理的方法有冲突导致的. 这个的解决办法是:先revert这个文件,然后再update.