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环 ...
随机推荐
- Write Cache-friendly Code
Computer Systems A Programmer's Perspective Second Edition In Section 6.2, we introduced the idea of ...
- OmniThreadLibrary 3.03b发布了
虽然版本号升的不大,但这也是一个重要的版本.作者发现了一个长期存在的bug,就是建立一个线程,如果不指定线程的优先级则默认设置为idle.(正确的应是Normal) 看一下具体的改动情况: 新功能: ...
- 浅析C++的内存管理
在C++中,内存分成5个区,他们分别是堆.栈.自由存储区.全局/ 静态存储区和常量存储区. 栈,就是那些由编译器在需要的时候分配,在不需要的时候自动清楚的变量的存储区.里面的变量通常是局部变量.函数参 ...
- 原生js实现跑马灯抽奖效果
目前好多的微信活动都有一些抽奖活动,其中就有跑马灯. <!DOCTYPE html> <html> <head> <title>跑马灯效果</ti ...
- 【ZBar】ios错误ignoring file xxx missing required architecture x86_64 in file
解决方法: 1.在Project target里"Architectures"设置为:Standard (armv7,armv7s)或者 Standard (armv7,arm6 ...
- FTS抓包看AVDTP
1.概述 测试过程为打开Audio连接,没有听音乐,人后断开Audio连接,主要目的是为了测试AVDTP的工作流程. 2.Frame分析 首先贴出抓取的关于AVDTP的包: 在L2CAP ...
- Lambda 中如果构建一个查询条件,扔该Where返回我们需要的数据。
有一个需求,比如所 省市县 这三个查询条件 都可能有可能没有,但是我们的查询条件怎么构建呢 首先需要看一下 Lambda中Where这个方法需要什么参数 public static IEnumerab ...
- netstat 查看TCP状态值
一.TCP 状态值 netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}' CLOSED:无连接是活动的或正在进行LI ...
- 利用快速排序原理找出数组中前n大的数
#include <stdio.h> #include <stdint.h> #include <stdlib.h> #define MAX_SIZE 400001 ...
- Java 实现导出excel表 POI
1.首先下载poi-3.6-20091214.jar 2.Student.java import java.util.Date; public class Student { private int ...