BTree索引使用技巧

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了BTree索引使用技巧相关的知识,希望对你有一定的参考价值。

参考技术A explain select * from t_content where content_id = 17076710;
drop index idx_uid on t_content;
create index idx_uid on t_content(uid);
explain select * from t_content where uid=16940130;

drop index idx_uid on t_content;
create index idx_uid on t_content(uid);

explain select * from t_content where uid = 16940130;

explain select * from t_content where uid > 1260000 and uid < 12610000;

explain select * from t_content where uid like '1694%';

drop index idx_share_url on t_content;
create index idx_share_url on t_content(share_url);

explain select * from t_content where share_url like ' http://a.f.budejie.com/share/%' ;

explain select * from t_content where share_url like '% http://a.f.budejie.com/share/17076710' ;
explain select * from t_content where share_url like '% http://a.f.budejie.com/share/17076710%' ;

drop index idx_uid_sid on t_content;
create index idx_uid_sid on t_content( uid , source_id );

EXPLAIN select * from t_content where uid = 14206986 ;

EXPLAIN select * from t_content where uid=14206986 and source_id = 13054 ;

EXPLAIN select * from t_content where source_id <> 13054 ;
EXPLAIN select * from t_content where source_id <=13053 or source_id >=13055;

sql 使用BTREE创建索引

CREATE INDEX name_index ON reports_json_orders USING BTREE(((data ->> 'name')));

-- To create a B-tree index on the column title in the table films:
CREATE UNIQUE INDEX title_idx ON films (title);

以上是关于BTree索引使用技巧的主要内容,如果未能解决你的问题,请参考以下文章

sqlite 怎么知道索引在哪个索引btree里

MySQL的btree索引和hash索引的区别

btree索引无法使用处理方式

btree索引无法使用处理方式

btree索引无法使用处理方式

sql 使用BTREE创建索引