300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > 达梦数据库索引的创建与测试

达梦数据库索引的创建与测试

时间:2022-07-09 11:07:57

相关推荐

达梦数据库索引的创建与测试

索引是:一种数据库对象,通过指针加速查询速度,通过快速定位数 据的方法,减少磁盘 I/O,索引与表相互独立,服务器自动使用和维 护索引。索引占空间。 达梦支持的索引:二级索引,位图过索引,唯一索引,复合索引,函 数索引,分区索引等。 索引的作用:加快表的查询,增加数据库的查询性能。 8889 索引是一棵倒置的树,使用索引,就是对这棵树做遍历。 达梦采用 B+树的方式来创建索引 创建索引 1、构建表

SQL> create table test.emp as select * from dmhr.employee;

2、创建索引表空间

SQL> create tablespace index1 datafile '/dm8/data/DAMENG/index1_01.dbf' size 32;

3、创建索引

SQL> create index ind_emp on test.emp(employee_id) tablespace index1;

测试索引性能,生产运行系统中,需要在数据库使用率不高的时段来做。否则可能影响其他用户使用数据库

测试过程:

1.测试索引前的检索性能:

SQL>explain select * from test.emp where employee< 20;

2.刷新索引

SQL>begin dbms_stats.gather_table_status('TEST','EMP');end;/

3.再次测试索引前的检索性能:

SQL>explain select * from test.emp where employee< 20;

查看索引:

select * from dba_indexes where owner='TEST' AND table_name='EMP';

索引维护:

Alter index test.ind_emp rebulid;

Alter index test.ind_emp rebulid online;

删除索引:

Drop index test.ind_emp;

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。