创建测试表
- CREATETABLE TEST_PREFIX_IND (
- ID INT(10) PRIMARY KEY AUTO_INCREMENT,
- NORMAL_STR VARCHAR(20) ,
- LONG_STR VARCHAR(1000),
- TEXT_STR TEXT,
- BLOB_STR BLOB
- );
插入10000行记录:
- drop procedure if exists init_test_prefix_ind;;
- createprocedure init_test_prefix_ind(n int)
- begin
- declare iint default 0;
- while i< n do
- insertinto test_prefix_ind(NORMAL_STR,long_str, TEXT_STR,BLOB_STR)
- values(random_str(20),random_str(rand()*1000+1),random_str(rand()*1000+1),random_str(rand()*300+1));
- seti=i+1;
- endwhile;
- end;;
- callinit_test_prefix_ind(10000);;
- altertable test_prefix_ind add key(LONG_STR);;
成功了,然则Sub_part显示为767,表示体系主动创建了前缀长度为767的前缀索引;
看看大年夜小: 8992k
- select * from test_substr where substr(object_name,1,<N>)=:a and substr(object_name,1,5)=substr(:a,1,5);
测验测验在TEXT和BLOB的栏位上直接创建索引
在TEXT和BLOB栏位上建立索引,必须指定前缀长度。
- alter table test_prefix_ind add key(text_str(30));;
神奇的工作产生了,切实扑晡策了索引,Oracle也支撑前缀索引~~
看看大年夜小,528k(9520-8992), 远远小于LONG_STR的8992k.
推荐阅读
Memory Cleaner——简单好用的Windows内存优化工具
年前最后一场技巧盛宴 | 1月27日与京东、日记易技巧大年夜咖畅聊智能化运维成长趋势!Windows 操作体系在没有效户干涉的情况下可以相当有效地治理计算机内存的应用情况,但不是说就没有可以优化和改进的>>>详细阅读
地址:http://www.17bianji.com/lsqh/40347.html
1/2 1