这一章主要涉及TiDB如下的源码: 1. 扫表算子怎样转换为扫索引算子; 2. 怎样把Selection算子的过滤条件化简, 转为区间扫描; 假设我们有一个表: t1( id int primary key not null auto_increment, a int, b int, c varchar(), index(a) ); 其中, id 是主键, a 是索引; 我们执行如下的 sql: or ( a> and (a> and a <) and a<); 这条 sql 的最…
本章涉及的内容是TiDB的计算层代码,就是我们编译完 TiDB 后在bin目录下生成的 tidb-server 的可执行文件,它是用 go 实现的,里面对 TiPD 和 TiKV实现了Mock,可以单独运行: 用explain语句可以看到一条sql在TiDB中生成的最终执行计划,例如:我们有一条关联子查询: select * from t1 where t1.a in (select t2.a from t2 where t2.b = t1.b); tidb> explain select *…
-- 查询一个数据库表中的索引及索引列use [RuPengWangDB]GOSELECT indexname = a.name , tablename = c. name , indexcolumns = d .name , a .indidFROM sysindexes a JOIN sysindexkeys b ON a .id = b .id AND a .indid = b.indid JOIN sysobjects c ON b .id = c .id …
无法重新组织表 "ty_wf_ex_local_process_info" 的索引 "idx_prc_act_id" (分区 1),因为已禁用页级锁定. ALTER INDEX idx_prc_act_id ON [dbo].[ty_wf_ex_local_process_info] SET ( ALLOW_PAGE_LOCKS = ON )…