传统创建索引和concurrently创建索引区别

传统创建索引和concurrently创建索引区别

##传统方式
create index index_name on schema.table_name(col_name);

##concurrently方式
create index concurrently index_name on schema.table_name(col_name);

区别

1.create index concurrently是在线创建索引,不堵塞其他会话对被创建索引表的DML操作,适合生产业务

2.如果使用concurrently创建索引等待时间过长,强制结束后,索引已经被创建了,但是状态标记为invalid状态,需要重建

3.create index传统的创建索引的方式会堵塞其他会话的DML

4.传统创建建索引时DB只扫描一次表

5.concurrently创建索引,会引发DB扫两次表,同时等待所有潜在会读到该索引的事务结束,系统的CPU和IO,内存等会受一些影响。

参考文档:https://blog.csdn.net/weixin_34393428/article/details/89730747

Guess you like

Origin blog.csdn.net/weixin_44375561/article/details/120782550