month range seq
1 a 01
1 a 02
...
1 a 10000
1 b 01
1 b 02
...
1 b 10000
1 c 01
1 c 02
...
1 c 10000
2 a 01
2 a 02
...
2 a 10000
2 b 01
2 b 02
...
2 b 10000
2 c 01
2 c 02
...
2 c 10000
2 d 01
2 d 02
...
2 d 10000
2 e 01
2 e 02
...
2 e 10000
3 a 01
3 a 02
...
3 a 10000
3 b 01
3 b 02
...
3 b 10000
3 c 01
3 c 02
...
3 c 10000
3 d 01
3 d 02
...
3 d 10000
3 e 01
3 e 02
...
3 e 10000
4月
。。。
5月
。。。
12月
根索引结构:
1,a,01
1,a,101
1,a,201
...
1,a,9901
1,b,01
1,b,101
1,b,201
...
1,b,9901
...
...
...
假设一个叶子节点存100条数据。且索引只有2层
range scan:
month=2 and seq=105
read 401 leafblocks + 1 root blocks (block start: 2,a,101 --> 2,a,200 / block end: 2,e,101 --> 2,e,200 )
count : 402 blocks
skip scan:
month=2 and range_code='a' and seq=105 read 1 leafblocks + 1 roots (block: 1,a,101 --> 1,a,110)
or
month=2 and range_code='b' and seq=105 read 1 leafblocks + 1 roots
or
month=2 and range_code='c' and seq=105 read 1 leafblocks + 1 roots
or
month=2 and range_code='d' and seq=105 read 1 leafblocks + 1 roots
or
month=2 and range_code='e' and seq=105 read 1 leafblocks + 1 roots
count: 10 blocks