多字段索引 explain select from tmulidx where f11 or f22 or f33 ; QUERY PLAN Remote Fast Query Execution (cost0.00..0.00 rows0 width0) Node/s: dn001, dn002 > Seq Scan on tmulidx (cost0.00..12966.87 rows3 width16) Filter: ((f1 1) OR (f2 2) OR (f3 3)) (4 rows) Time: 3.153 ms 如果返回字段全部在索引文件中,则只需要扫描索引,IO 开销会更少。 plaintext teledb explain select f1,f2,f3 from tmulidx where f11 ; QUERY PLAN Remote Fast Query Execution (cost0.00..0.00 rows0 width0) Node/s: dn01 > Index Only Scan using tmulidxidx on tmulidx (cost0.42..8.44 rows1 width12) Index Cond: (f1 1) (4 rows) Time: 2.630 ms 更新性能比单字段多索引文件要好 多字段 plaintext teledb truncate table tmulidx; TRUNCATE TABLE Time: 44.930 ms teledb insert into tmulidx select t,t,t,t from generateseries(1,1000000) as t; INSERT 0 1000000 Time: 1985.901 ms (00:01.986) 单字段 plaintext teledb create table tsimpleidx (f1 int,f2 int,f3 int,f4 int); CREATE TABLE teledb create index tsimpleidxidx on tsimpleidx(f1); CREATE INDEX teledb create index tsimpleidxidx1 on tsimpleidx(f2); CREATE INDEX teledb create index tsimpleidxidx2 on tsimpleidx(f3); CREATE INDEX teledb