MogDB 学习笔记之 -- 索引失效
[[toc]]
# 概念描述
哪些操作会导致分区表的全局索引失效(比如 move partition,drop partition ,truncate partition ,split partition , merge partitions )
# 测试验证
1、环境准备
```
CREATE TABLE t_ran
(
user_number NUMBER(11),
start_time timestamp(0) without time zone,
business_name character(2000),
ng_staff_id character(50)
)
PARTITION BY RANGE (start_time)
(PARTITION PART_20180228 VALUES LESS THAN (TO_DATE('2018-03-01','YYYY-MM-DD')),
PARTITION PART_20180301 VALUES LESS THAN (TO_DATE('2018-03-02','YYYY-MM-DD')),
PARTITION PART_20180302 VALUES LESS THAN (TO_DATE('2018-03-03','YYYY-MM-DD')),
PARTITION PART_20180303 VALUES LESS THAN (TO_DATE('2018-03-04','YYYY-MM-DD')),
PARTITION PART_20180304 VALUES LESS THAN (TO_DATE('2018-03-05','YYYY-MM-DD')),
PARTITION PART_20180305 VALUES LESS THAN (TO_DATE('2018-03-06','YYYY-MM-DD')),
PARTITION PART_20180306 VALUES LESS THAN (TO_DATE('2018-03-07','YYYY-MM-DD')),
PARTITION PART_20180307 VALUES LESS THAN (TO_DATE('2018-03-08','YYYY-MM-DD')),
PARTITION PART_20180308 VALUES LESS THAN (TO_DATE('2018-03-09','YYYY-MM-DD')),
PARTITION PART_20180309 VALUES LESS THAN (TO_DATE('2018-03-10','YYYY-MM-DD')),
PARTITION PART_20180310 VALUES LESS THAN (TO_DATE('2018-03-11','YYYY-MM-DD')),
PARTITION PART_20180311 VALUES LESS THAN (TO_DATE('2018-03-12','YYYY-MM-DD')),
PARTITION PART_20180312 VALUES LESS THAN (TO_DATE('2018-03-13','YYYY-MM-DD')),
PARTITION PART_20180313 VALUES LESS THAN (TO_DATE('2018-03-14','YYYY-MM-DD')),
PARTITION PART_20180314 VALUES LESS THAN (TO_DATE('2018-03-15','YYYY-MM-DD')),
PARTITION PART_20180315 VALUES LESS THAN (TO_DATE('2018-03-16','YYYY-MM-DD')),
PARTITION PART_20180316 VALUES LESS THAN (TO_DATE('2018-03-17','YYYY-MM-DD')),
PARTITION PART_20180317 VALUES LESS THAN (TO_DATE('2018-03-18','YYYY-MM-DD')),
PARTITION PART_20180318 VALUES LESS THAN (TO_DATE('2018-03-19','YYYY-MM-DD')),
PARTITION PART_20180319 VALUES LESS THAN (TO_DATE('2018-03-20','YYYY-MM-DD')),
PARTITION PART_20180320 VALUES LESS THAN (TO_DATE('2018-03-21','YYYY-MM-DD')),
PARTITION PART_20180321 VALUES LESS THAN (TO_DATE('2018-03-22','YYYY-MM-DD')),
PARTITION PART_20180322 VALUES LESS THAN (TO_DATE('2018-03-23','YYYY-MM-DD')),
PARTITION PART_20180323 VALUES LESS THAN (TO_DATE('2018-03-24','YYYY-MM-DD')),
PARTITION PART_20180324 VALUES LESS THAN (TO_DATE('2018-03-25','YYYY-MM-DD')),
PARTITION PART_20180325 VALUES LESS THAN (TO_DATE('2018-03-26','YYYY-MM-DD')),
PARTITION PART_20180326 VALUES LESS THAN (TO_DATE('2018-03-27','YYYY-MM-DD')),
PARTITION PART_20180327 VALUES LESS THAN (TO_DATE('2018-03-28','YYYY-MM-DD')),
PARTITION PART_20180328 VALUES LESS THAN (TO_DATE('2018-03-29','YYYY-MM-DD')),
PARTITION PART_20180329 VALUES LESS THAN (TO_DATE('2018-03-30','YYYY-MM-DD')),
PARTITION PART_20180330 VALUES LESS THAN (TO_DATE('2018-03-31','YYYY-MM-DD')),
PARTITION PART_20180331 VALUES LESS THAN (TO_DATE('2018-04-01','YYYY-MM-DD')),
PARTITION PART_max VALUES LESS THAN (MAXVALUE))
;
openGauss=#
openGauss=# \d pg_index
Table "pg_catalog.pg_index"
Column | Type | Modifiers
----------------+--------------+-----------
indexrelid | oid | not null
indrelid | oid | not null
indnatts | smallint | not null
indisunique | boolean | not null
indisprimary | boolean | not null
indisexclusion | boolean | not null
indimmediate | boolean | not null
indisclustered | boolean | not null
indisusable | boolean | not null
indisvalid | boolean | not null
indcheckxmin | boolean | not null
indisready | boolean | not null
indkey | int2vector | not null
indcollation | oidvector | not null
indclass | oidvector | not null
indoption | int2vector | not null
indexprs | pg_node_tree |
indpred | pg_node_tree |
indisreplident | boolean |
indnkeyatts | smallint |
Indexes:
"pg_index_indexrelid_index" UNIQUE, btree (indexrelid) TABLESPACE pg_default
"pg_index_indrelid_index" btree (indrelid) TABLESPACE pg_default
Replica Identity: NOTHING
openGauss=# insert into t_ran select * from customer_t_copy;
INSERT 0 1282751
openGauss=# CREATE INDEX ind_t_ran ON t_ran(start_time) LOCAL;
CREATE INDEX
openGauss=#
openGauss=# CREATE INDEX ind2_t_ran ON t_ran(start_time,user_number) ;
CREATE INDEX
```
2、测试 truncate partition
```
openGauss=# select indexrelid,indisusable,indexrelid::regclass,indrelid::regclass,pg_get_indexdef(indexrelid) from pg_index where indrelid='t_ran'::regclass;
indexrelid | indisusable | indexrelid | indrelid | pg_get_indexdef
------------+-------------+------------+----------+--------------------------------------------------------------------------------------------------------------------------
41104 | t | ind_t_ran | t_ran | CREATE INDEX ind_t_ran ON t_ran USING ubtree (start_time) LOCAL WITH (storage_type=USTORE) TABLESPACE pg_default
41138 | t | ind2_t_ran | t_ran | CREATE INDEX ind2_t_ran ON t_ran USING ubtree (start_time, user_number) WITH (storage_type=USTORE) TABLESPACE pg_default
(2 rows)
openGauss=# alter table t_ran truncate partition part_20180319;
ALTER TABLE
openGauss=# select indexrelid,indisusable,indexrelid::regclass,indrelid::regclass,pg_get_indexdef(indexrelid) from pg_index where indrelid='t_ran'::regclass;
indexrelid | indisusable | indexrelid | indrelid | pg_get_indexdef
------------+-------------+------------+----------+--------------------------------------------------------------------------------------------------------------------------
41104 | t | ind_t_ran | t_ran | CREATE INDEX ind_t_ran ON t_ran USING ubtree (start_time) LOCAL WITH (storage_type=USTORE) TABLESPACE pg_default
41138 | f | ind2_t_ran | t_ran | CREATE INDEX ind2_t_ran ON t_ran USING ubtree (start_time, user_number) WITH (storage_type=USTORE) TABLESPACE pg_default
(2 rows)
openGauss=# alter index ind2_t_ran rebuild;
REINDEX
openGauss=#
openGauss=#
openGauss=# select indexrelid,indisusable,indexrelid::regclass,indrelid::regclass,pg_get_indexdef(indexrelid) from pg_index where indrelid='t_ran'::regclass;
indexrelid | indisusable | indexrelid | indrelid | pg_get_indexdef
------------+-------------+------------+----------+--------------------------------------------------------------------------------------------------------------------------
41104 | t | ind_t_ran | t_ran | CREATE INDEX ind_t_ran ON t_ran USING ubtree (start_time) LOCAL WITH (storage_type=USTORE) TABLESPACE pg_default
41138 | t | ind2_t_ran | t_ran | CREATE INDEX ind2_t_ran ON t_ran USING ubtree (start_time, user_number) WITH (storage_type=USTORE) TABLESPACE pg_default
(2 rows)
```
结论:经过以上实验验证,发现 indisusable 字段发生变化,truncate partition 这个操作会导致全局索引失效,分区索引没有影响。
3、测试 split partition
```
openGauss=# select relname,parentid,interval,boundaries from pg_partition where parentid=(select parentid from pg_partition where relname='t_ran' );
relname | parentid | interval | boundaries
---------------+----------+----------+-------------------------
t_ran | 40968 | |
part_20180301 | 40968 | | {"2018-03-02 00:00:00"}
part_20180302 | 40968 | | {"2018-03-03 00:00:00"}
part_20180303 | 40968 | | {"2018-03-04 00:00:00"}
part_20180304 | 40968 | | {"2018-03-05 00:00:00"}
part_20180305 | 40968 | | {"2018-03-06 00:00:00"}
part_20180306 | 40968 | | {"2018-03-07 00:00:00"}
part_20180307 | 40968 | | {"2018-03-08 00:00:00"}
part_20180308 | 40968 | | {"2018-03-09 00:00:00"}
part_20180309 | 40968 | | {"2018-03-10 00:00:00"}
part_20180310 | 40968 | | {"2018-03-11 00:00:00"}
part_20180311 | 40968 | | {"2018-03-12 00:00:00"}
part_20180312 | 40968 | | {"2018-03-13 00:00:00"}
part_20180313 | 40968 | | {"2018-03-14 00:00:00"}
part_20180316 | 40968 | | {"2018-03-17 00:00:00"}
part_20180317 | 40968 | | {"2018-03-18 00:00:00"}
part_20180318 | 40968 | | {"2018-03-19 00:00:00"}
part_20180319 | 40968 | | {"2018-03-20 00:00:00"}
part_20180320 | 40968 | | {"2018-03-21 00:00:00"}
part_20180322 | 40968 | | {"2018-03-23 00:00:00"}
part_20180323 | 40968 | | {"2018-03-24 00:00:00"}
part_20180324 | 40968 | | {"2018-03-25 00:00:00"}
part_20180326 | 40968 | | {"2018-03-27 00:00:00"}
part_20180327 | 40968 | | {"2018-03-28 00:00:00"}
part_20180328 | 40968 | | {"2018-03-29 00:00:00"}
part_20180330 | 40968 | | {"2018-03-31 00:00:00"}
part_20180331 | 40968 | | {"2018-04-01 00:00:00"}
part_max | 40968 | | {NULL}
(28 rows)
这个是opengauss数据库句法问题,和Oracle数据库语法不一样。
penGauss=# alter table t_ran split partition part_max at (to_date('2018-04-02','YYYY-MM-DD')) into (partition part_20180401,partition part_max);
ERROR: resulting partition "part_max" name conflicts with that of an existing partition
^
--------------------
GAUSS-00923: "resulting partition '%s' name conflicts with that of an existing partition"
SQLSTATE: 42710
错误原因: SPLIT PARTITION操作得到的分区名称与已有分区名冲突,该分割分区操作不能执行。
解决办法: 建议修改结果分区名称。
---------------------
openGauss=# select relname,parentid,interval,boundaries from pg_partition where parentid=(select parentid from pg_partition where relname='t_ran' );
relname | parentid | interval | boundaries
---------------+----------+----------+-------------------------
t_ran | 40968 | |
part_20180301 | 40968 | | {"2018-03-02 00:00:00"}
part_20180302 | 40968 | | {"2018-03-03 00:00:00"}
part_20180303 | 40968 | | {"2018-03-04 00:00:00"}
part_20180304 | 40968 | | {"2018-03-05 00:00:00"}
part_20180305 | 40968 | | {"2018-03-06 00:00:00"}
part_20180306 | 40968 | | {"2018-03-07 00:00:00"}
part_20180307 | 40968 | | {"2018-03-08 00:00:00"}
part_20180308 | 40968 | | {"2018-03-09 00:00:00"}
part_20180309 | 40968 | | {"2018-03-10 00:00:00"}
part_20180310 | 40968 | | {"2018-03-11 00:00:00"}
part_20180311 | 40968 | | {"2018-03-12 00:00:00"}
part_20180312 | 40968 | | {"2018-03-13 00:00:00"}
part_20180313 | 40968 | | {"2018-03-14 00:00:00"}
part_20180316 | 40968 | | {"2018-03-17 00:00:00"}
part_20180317 | 40968 | | {"2018-03-18 00:00:00"}
part_20180318 | 40968 | | {"2018-03-19 00:00:00"}
part_20180320 | 40968 | | {"2018-03-21 00:00:00"}
part_20180322 | 40968 | | {"2018-03-23 00:00:00"}
part_20180323 | 40968 | | {"2018-03-24 00:00:00"}
part_20180324 | 40968 | | {"2018-03-25 00:00:00"}
part_20180326 | 40968 | | {"2018-03-27 00:00:00"}
part_20180327 | 40968 | | {"2018-03-28 00:00:00"}
part_20180328 | 40968 | | {"2018-03-29 00:00:00"}
part_20180330 | 40968 | | {"2018-03-31 00:00:00"}
part_20180331 | 40968 | | {"2018-04-01 00:00:00"}
part_20180319 | 40968 | | {"2018-03-20 00:00:00"}
part_20180401 | 40968 | | {"2018-04-02 00:00:00"}
part_max1 | 40968 | | {NULL}
(29 rows)
openGauss=# alter table t_ran split partition part_max at (to_date('2018-04-02','YYYY-MM-DD')) into (partition part_20180401,partition part_max1);
ALTER TABLE
openGauss=# select indexrelid,indisusable,indexrelid::regclass,indrelid::regclass,pg_get_indexdef(indexrelid) from pg_index where indrelid='t_ran'::regclass;
indexrelid | indisusable | indexrelid | indrelid | pg_get_indexdef
------------+-------------+------------+----------+--------------------------------------------------------------------------------------------------------------------------
41104 | t | ind_t_ran | t_ran | CREATE INDEX ind_t_ran ON t_ran USING ubtree (start_time) LOCAL WITH (storage_type=USTORE) TABLESPACE pg_default
41138 | f | ind2_t_ran | t_ran | CREATE INDEX ind2_t_ran ON t_ran USING ubtree (start_time, user_number) WITH (storage_type=USTORE) TABLESPACE pg_default
(2 rows)
openGauss=# alter index ind2_t_ran rebuild;
REINDEX
openGauss=#
openGauss=# select indexrelid,indisusable,indexrelid::regclass,indrelid::regclass,pg_get_indexdef(indexrelid) from pg_index where indrelid='t_ran'::regclass;
indexrelid | indisusable | indexrelid | indrelid | pg_get_indexdef
------------+-------------+------------+----------+--------------------------------------------------------------------------------------------------------------------------
41104 | t | ind_t_ran | t_ran | CREATE INDEX ind_t_ran ON t_ran USING ubtree (start_time) LOCAL WITH (storage_type=USTORE) TABLESPACE pg_default
41138 | t | ind2_t_ran | t_ran | CREATE INDEX ind2_t_ran ON t_ran USING ubtree (start_time, user_number) WITH (storage_type=USTORE) TABLESPACE pg_default
(2 rows)
openGauss=#
```
结论:经过以上实验验证,发现 indisusable 字段发生变化,split partition 这个操作会导致全局索引失效,分区索引没有影响。
4、测试merge partitions
```
openGauss=# alter table t_ran merge partitions part_20180320,part_20180322 into partition part_20180322;
ALTER TABLE
openGauss=# select indexrelid,indisusable,indexrelid::regclass,indrelid::regclass,pg_get_indexdef(indexrelid) from pg_index where indrelid='t_ran'::regclass;
indexrelid | indisusable | indexrelid | indrelid | pg_get_indexdef
------------+-------------+------------+----------+--------------------------------------------------------------------------------------------------------------------------
41104 | t | ind_t_ran | t_ran | CREATE INDEX ind_t_ran ON t_ran USING ubtree (start_time) LOCAL WITH (storage_type=USTORE) TABLESPACE pg_default
41138 | f | ind2_t_ran | t_ran | CREATE INDEX ind2_t_ran ON t_ran USING ubtree (start_time, user_number) WITH (storage_type=USTORE) TABLESPACE pg_default
(2 rows)
openGauss=# select 'alter index ' || indexrelid::regclass ||' rebuild; ' from pg_index where indisusable='f';
?column?
----------------------------------
alter index ind2_t_ran rebuild;
(1 row)
openGauss=# alter index ind2_t_ran rebuild;
REINDEX
openGauss=#
openGauss=#
openGauss=# select indexrelid,indisusable,indexrelid::regclass,indrelid::regclass,pg_get_indexdef(indexrelid) from pg_index where indrelid='t_ran'::regclass;
indexrelid | indisusable | indexrelid | indrelid | pg_get_indexdef
------------+-------------+------------+----------+--------------------------------------------------------------------------------------------------------------------------
41104 | t | ind_t_ran | t_ran | CREATE INDEX ind_t_ran ON t_ran USING ubtree (start_time) LOCAL WITH (storage_type=USTORE) TABLESPACE pg_default
41138 | t | ind2_t_ran | t_ran | CREATE INDEX ind2_t_ran ON t_ran USING ubtree (start_time, user_number) WITH (storage_type=USTORE) TABLESPACE pg_default
(2 rows)
```
结论:经过以上实验验证,发现 indisusable 字段发生变化,merge partition 这个操作会导致全局索引失效,分区索引没有影响。
5、drop partition
```
openGauss=# alter table t_ran drop partition part_20180322;
ALTER TABLE
openGauss=# select relname,parentid,interval,boundaries from pg_partition where parentid=(select parentid from pg_partition where relname='t_ran' );
relname | parentid | interval | boundaries
---------------+----------+----------+-------------------------
t_ran | 40968 | |
part_20180301 | 40968 | | {"2018-03-02 00:00:00"}
part_20180302 | 40968 | | {"2018-03-03 00:00:00"}
part_20180303 | 40968 | | {"2018-03-04 00:00:00"}
part_20180304 | 40968 | | {"2018-03-05 00:00:00"}
part_20180305 | 40968 | | {"2018-03-06 00:00:00"}
part_20180306 | 40968 | | {"2018-03-07 00:00:00"}
part_20180307 | 40968 | | {"2018-03-08 00:00:00"}
part_20180308 | 40968 | | {"2018-03-09 00:00:00"}
part_20180309 | 40968 | | {"2018-03-10 00:00:00"}
part_20180310 | 40968 | | {"2018-03-11 00:00:00"}
part_20180311 | 40968 | | {"2018-03-12 00:00:00"}
part_20180312 | 40968 | | {"2018-03-13 00:00:00"}
part_20180313 | 40968 | | {"2018-03-14 00:00:00"}
part_20180316 | 40968 | | {"2018-03-17 00:00:00"}
part_20180317 | 40968 | | {"2018-03-18 00:00:00"}
part_20180318 | 40968 | | {"2018-03-19 00:00:00"}
part_20180323 | 40968 | | {"2018-03-24 00:00:00"}
part_20180324 | 40968 | | {"2018-03-25 00:00:00"}
part_20180326 | 40968 | | {"2018-03-27 00:00:00"}
part_20180327 | 40968 | | {"2018-03-28 00:00:00"}
part_20180328 | 40968 | | {"2018-03-29 00:00:00"}
part_20180330 | 40968 | | {"2018-03-31 00:00:00"}
part_20180331 | 40968 | | {"2018-04-01 00:00:00"}
part_20180319 | 40968 | | {"2018-03-20 00:00:00"}
part_20180401 | 40968 | | {"2018-04-02 00:00:00"}
part_max1 | 40968 | | {NULL}
(27 rows)
openGauss=# select indexrelid,indisusable,indexrelid::regclass,indrelid::regclass,pg_get_indexdef(indexrelid) from pg_index where indrelid='t_ran'::regclass;
indexrelid | indisusable | indexrelid | indrelid | pg_get_indexdef
------------+-------------+------------+----------+--------------------------------------------------------------------------------------------------------------------------
41104 | t | ind_t_ran | t_ran | CREATE INDEX ind_t_ran ON t_ran USING ubtree (start_time) LOCAL WITH (storage_type=USTORE) TABLESPACE pg_default
41138 | f | ind2_t_ran | t_ran | CREATE INDEX ind2_t_ran ON t_ran USING ubtree (start_time, user_number) WITH (storage_type=USTORE) TABLESPACE pg_default
(2 rows)
openGauss=# alter index ind2_t_ran rebuild;
REINDEX
openGauss=#
openGauss=#
openGauss=# select indexrelid,indisusable,indexrelid::regclass,indrelid::regclass,pg_get_indexdef(indexrelid) from pg_index where indrelid='t_ran'::regclass;
indexrelid | indisusable | indexrelid | indrelid | pg_get_indexdef
------------+-------------+------------+----------+--------------------------------------------------------------------------------------------------------------------------
41104 | t | ind_t_ran | t_ran | CREATE INDEX ind_t_ran ON t_ran USING ubtree (start_time) LOCAL WITH (storage_type=USTORE) TABLESPACE pg_default
41138 | t | ind2_t_ran | t_ran | CREATE INDEX ind2_t_ran ON t_ran USING ubtree (start_time, user_number) WITH (storage_type=USTORE) TABLESPACE pg_default
(2 rows)
```
结论:经过以上实验验证,发现 indisusable 字段发生变化,drop partition 这个操作会导致全局索引失效,分区索引没有影响。
6、move partition
```
openGauss=# select indexrelid,indisusable,indexrelid::regclass,indrelid::regclass,pg_get_indexdef(indexrelid) from pg_index where indrelid='t_ran'::regclass;
indexrelid | indisusable | indexrelid | indrelid | pg_get_indexdef
------------+-------------+------------+----------+--------------------------------------------------------------------------------------------------------------------------
41138 | t | ind2_t_ran | t_ran | CREATE INDEX ind2_t_ran ON t_ran USING ubtree (start_time, user_number) WITH (storage_type=USTORE) TABLESPACE pg_default
41104 | t | ind_t_ran | t_ran | CREATE INDEX ind_t_ran ON t_ran USING ubtree (start_time) LOCAL WITH (storage_type=USTORE) TABLESPACE pg_default
(2 rows)
openGauss=# alter table t_ran move partition part_20180401 TABLESPACE pg_default;
ALTER TABLE
openGauss=# select indexrelid,indisusable,indexrelid::regclass,indrelid::regclass,pg_get_indexdef(indexrelid) from pg_index where indrelid='t_ran'::regclass;
indexrelid | indisusable | indexrelid | indrelid | pg_get_indexdef
------------+-------------+------------+----------+--------------------------------------------------------------------------------------------------------------------------
41138 | t | ind2_t_ran | t_ran | CREATE INDEX ind2_t_ran ON t_ran USING ubtree (start_time, user_number) WITH (storage_type=USTORE) TABLESPACE pg_default
41104 | t | ind_t_ran | t_ran | CREATE INDEX ind_t_ran ON t_ran USING ubtree (start_time) LOCAL WITH (storage_type=USTORE) TABLESPACE pg_default
(2 rows)
miao=> CREATE TABLESPACE ds_tbs RELATIVE LOCATION 'db_tbs/';
CREATE TABLESPACE
miao=> \q
[omm@db1 db1]$
openGauss=# alter table t_ran move partition part_20180401 TABLESPACE ds_tbs;
ALTER TABLE
openGauss=# select indexrelid,indisusable,indexrelid::regclass,indrelid::regclass,pg_get_indexdef(indexrelid) from pg_index where indrelid='t_ran'::regclass;
indexrelid | indisusable | indexrelid | indrelid | pg_get_indexdef
------------+-------------+------------+----------+--------------------------------------------------------------------------------------------------------------------------
41138 | t | ind2_t_ran | t_ran | CREATE INDEX ind2_t_ran ON t_ran USING ubtree (start_time, user_number) WITH (storage_type=USTORE) TABLESPACE pg_default
41104 | t | ind_t_ran | t_ran | CREATE INDEX ind_t_ran ON t_ran USING ubtree (start_time) LOCAL WITH (storage_type=USTORE) TABLESPACE pg_default
(2 rows)
openGauss=#
```
结论:经过以上实验验证,发现 indisusable 字段没有变化,move partition 这个操作对全局索引和分区索引没有影响。
# 知识总结
1、truncate partition
全局索引:失效
分区索引:正常、没影响
2、split partition
全局索引:失效
分区索引:正常、没影响
3、merge partitions
全局索引:失效
分区索引:正常、没影响
4、drop partition
全局索引:失效
分区索引:正常、没影响
5、move partition
全局索引:正常、没影响
分区索引:正常、没影响
MogDB 学习笔记之 -- 索引失效的更多相关文章
- Linux~学习笔记目录索引
回到占占推荐博客索引 本篇文章是对自己学习Linux及在它的环境下部署工具的一个总结,以方便自己查阅,也给他人一个帮助,本文章同时会不断的更新,欢迎大家订阅! 本目录包括的内容会包括linux基础命令 ...
- Nginx学习笔记~目录索引
回到占占推荐博客索引 前几天整理了<Docker的学习笔记索引>,受到了很多朋友的关注,今天把Nginx的文章也整理一下,以后将永久更新,像大叔之前的<EF文章系列>,< ...
- MongoDB学习笔记-04 索引
索引是用来加速查询的.有了索引之后,数据库不必进行全表扫描,只需先在索引中查找,再根据找到的索引查找数据.MongoDB的索引几乎和传统关系型数据库一样. 创建索引 创建索引是在相应的集合中使用ens ...
- MS SqlServer学习笔记(索引)
1.索引分类 MS SqlServer提供了两种索引:聚集索引和非聚集索引: 聚集索引是将数据按照索引的顺序存放 非聚集索引是将索引和数据分离存放,通过指针将二者联系到一起. 因为两种索引对比: 使用 ...
- MySQL学习笔记(三)—索引
一.概述 1.基本概念 在大型数据库中,一张表中要容纳几万.几十万,甚至几百万的的数据,而当这些表与其他表连接后,所得到的新的数据数目更是要大大超出原来的表.当用户检索这么大量的数据时,经 ...
- 【Oracle学习笔记】索引
1 简介 1)索引是数据库对象之一,用于加快数据的检索,类似于书籍的索引.在数据库中索引可以减少数据库程序查询结果时需要读取的数据量,类似于在书籍中我们利用索引可以不用翻阅整本书即可找到想要的信息. ...
- MySQL实战45讲学习笔记:索引(第五讲)
一.需要回表的案例 在下面表T中,执行下面语句,需要执行几次树的搜索操作?会扫描多少行? select * from T where k between 3 and 5 1.初始化语句 mysql&g ...
- MySQL实战45讲学习笔记:索引(第四讲)
一.索引模型 1.索引的作用: 索引的出现其实是为了提高数据查询的效率,就像书的目录一样 提高数据查询效率 2.索引模型的优缺点比较 二.InnoDB索引模型 1.二叉树是搜索效率最高的,但是实际上大 ...
- mysql学习笔记--数据库索引
一.索引的优点:查询速度快 二.索引的缺点: 1. 增.删.改(数据操作语句)效率低了 2. 索引占用空间 三.索引类型: 1. 普通索引 2. 唯一索引(唯一键) 3. 主键索引:只要主键就自动创建 ...
- MySQL 5.6学习笔记(索引的创建与删除)
1. 创建索引 1.1 创建新表时同时建立索引 语法: create table table_name[col_name data_type] [unique|fulltext|spatial][in ...
随机推荐
- SQL语句查询关键字 多表查询
目录 SQL语句查询关键字 select from 编写顺序和查询数据 前期数据准备 编写SQL语句的小技巧 查询关键字之筛选 where 逻辑运算符 not and or between not b ...
- 学习ASP.NET Core Blazor编程系列十七——文件上传(上)
学习ASP.NET Core Blazor编程系列文章之目录 学习ASP.NET Core Blazor编程系列一--综述 学习ASP.NET Core Blazor编程系列二--第一个Blazor应 ...
- 【JVM实战系列】「监控调优体系」实战开发arthas-spring-boot-starter监控你的微服务是否健康
前提介绍 相信如果经历了我的上一篇Arthas的文章[[JVM实战系列]「监控调优体系」针对于Alibaba-Arthas的安装入门及基础使用开发实战指南]之后,相信你对Arthas的功能和使用应该有 ...
- Wireshark网卡无法找到或没有显示的问题
问题背景 最近在处理公司内网域名解析的问题,发现配置好一个新域名在内网环境可以正常解析成内网IP,但使用深信服VPN却无法正常解析,并且其他域名使用深信服VPN可以正常解析,所以参考<内网域名解 ...
- [C#]关于override和new在重写方法时的区别
规则: 在"运行时"遇到虚方法时,对象会调用虚成员派生得最远的.重写的实现. 如果是用new修饰符实现的方法,它会在基类面前隐藏派生类重新声明的成员,这时候会找到使用new修饰符的 ...
- 在GCP上创建Cloud SQL的三种方式(Console,gcloud,Terraform)
1 简介 Cloud SQL 是GCP上的关系型数据库,常用的有三种方式来创建: (1) 界面操作 (2) 命令行 gcloud (3) Terraform 在开始之前,可以查看:<初始化一个G ...
- 数据预处理时为什么要使用OneHot编码?
什么是LabelEncoder(整数编码) 整数编码 将一列文本数据转化成数值,即列中的每一个特征都通过一个整数来表示.例如,[red, blue, red, yellow] = [0,2,0,1]. ...
- linux 高效压缩工具之xz的压缩解压使用
xz是什么 高压缩率的工具,它使用 LZMA2 压缩算法,生成的压缩文件比传统使用的 gzip.bzip2 生成的压缩文件更小, 不过xz也有一个坏处就是压缩时间比较长,比7z压缩时间还长一些.不过压 ...
- 字符输入流读取字符数据-writer类
字符输入流读取字符数据 读取字符:read方法,每次可以读取一个字符的数据,提升为int类型,读取到文件末尾,返回-1,循环读取,代码使用演示∶ writer类 java.io.Filelwriter ...
- do-while循环-练习_用循环求出1-100之间的耦合数
do-while循环 do..while循环格式 初始化表达式① do{ 循环体③ 步进表达式④ }while(布尔表达式②); 执行流程 执行顺序:①③④>②③④>②③④-②不满足为止. ...