他的回复:
但是,当使用另一个非分布键列--unique2做为过滤条件列,且该列上也存在索引时,结果如下:testdb=> set max_datanode_for_plan=3;SETtestdb=> explain select * from tenk1 where unique2=10; QUERY PLAN---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Data Node Scan (cost=0.00..0.00 rows=0 width=0) Node/s: All datanodes Remote SQL: SELECT unique1, unique2, two, four, ten, twenty, hundred, thousand, twothousand, fivethous, tenthous, odd, even, stringu1, stringu2, string4 FROM user1.tenk1 WHERE unique2 = 10 Datanode Name: dn_6001_6002_6003 [Bypass] Index Scan using tenk1_unique2 on tenk1 (cost=0.00..2.28 rows=1 width=244) Index Cond: (unique2 = 10) Datanode Name: dn_6004_6005_6006 [Bypass] Index Scan using tenk1_unique2 on tenk1 (cost=0.00..2.28 rows=1 width=244) Index Cond: (unique2 = 10) Datanode Name: dn_6007_6008_6009 [Bypass] Index Scan using tenk1_unique2 on tenk1 (cost=0.00..2.28 rows=1 width=244) Index Cond: (unique2 = 10)(19 rows)testdb=> 如上,即使要访问所有DN,也会有Bypass。 此外,如果继续使用unique1列进行过滤,比如把条件改为 unique1=10, 这时,满足条件的数据,大概率是会分布在所有DN上的。此时的执行计划,也仍然有BYPASS字样。其执行计划与上边的类似,故这里不另外提供了。