Partition Index Scan¶
名称¶
分区表索引扫描算子
介绍¶
当分区表搜索条件的属性是索引字段时,在分区表上对数据进行索引扫描,类似于普通表的 Index Scan。
举例¶
--清理环境
DROP TABLE t1;
--创建分区表
CREATE TABLE t1(a int,b int)
PARTITION BY HASH(a, b) PARTITIONS 4;
CREATE INDEX idx1 ON t1(a, b) LOCAL;
INSERT INTO t1 SELECT generate_series(1,20),generate_series(21,40);
ANALYZE t1;
EXPLAIN ANALYZE SELECT * from t1 WHERE a>5 AND b<23;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------
Partition Index Scan using IDX1(Fast Index Scan)(1..4) on T1 (cost=0.01..21.44 rows=2 width=8) (actual time=0.06..0.06 rows=0 loops=1)
Index Key: ((A > 5) AND (B < 23))
Planning Time: 0.40 msec
Execution Time: 0.17 msec
(4 rows)
- using IDX1 算子属性,表示索引扫描使用的索引
- Fast Index Scan 算子属性,表示分区索引扫描类型
- on T1 算子属性,表示索引扫描的分区表