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环 ...
随机推荐
- VS编程中找不到Microsoft.Office.Core、Microsoft.Office.Interop.Word和VBIDE
在使用vs2005. vs2008. vs2010 制作包含 word等office的应用程序时,有时找不到对Microsoft.Office.Core. Microsoft.Office.Inter ...
- 迷宫dfs
#include<stdio.h>int mov1[4]={0,0,1,-1};int mov2[4]={1,-1,0,0};int map[5][5]={0,1,0,0,1, ...
- java Exchanger 2
//Listing 6-3. Using an Exchanger to Swap Buffers import java.util.ArrayList; import java.util.List; ...
- C、VDD、VSS、 VEE 和VPP的区别
http://www.cnblogs.com/crazybingo/archive/2010/05/14/1735802.html C.VDD.VSS. VEE 和VPP的区别 在电子电路中,常可以看 ...
- php YAF
Yaf 的特点: 用C语言开发的PHP框架, 相比原生的PHP, 几乎不会带来额外的性能开销. 所有的框架类, 不需要编译, 在PHP启动的时候加载, 并常驻内存. 更短的内存周转周期, 提高内存利用 ...
- xcode8继续愉快的使用插件
https://github.com/inket/update_xcode_plugins https://github.com/fpg1503/MakeXcodeGr8Again xcode8增加了 ...
- 【C51】单片机定时器介绍
标准51架构的单片机有2个定时器 :T0 和 T1,他们2个的用法几乎一样.下面主要讲T0定时器的用法. 初步认知 定时器 和 计数器 都是单片机中同一个模块.他们的实质都是: 加法存储计数器.对 ...
- CLH锁 、MCS锁
一.引文 1.1 SMP(Symmetric Multi-Processor) 对称多处理器结构,指服务器中多个CPU对称工作,每个CPU访问内存地址所需时间相同.其主要特征是共享,包含对CPU,内存 ...
- MongoDB聚合查询
1.count:查询记录条数 db.user.count() 它也跟find一样可以有条件的 db.user.count({}) 2.distinct:用来找出给定键的所有不同的值 db.user.d ...
- Magento多语言功能
Magento多语言功能是建立在视图(view)基础之上的,可以通过后台创建店铺视图来创建基于Magento的多语言店铺.本文为大家讲解如何创建多语言的功能.首先,进入“管理店铺”节点,如下所示. S ...