teledb=# create table t_sex(id int,sex text) ;
CREATE TABLE
teledb=#
teledb=# create index t_sex_sex_idx on t_sex (sex);
CREATE INDEX
teledb=# insert into t_sex select t,'男' from generate_series(1,1000000) as t;
INSERT 0 1000000
teledb=# insert into t_sex select t,'女' from generate_series(1,100) as t;
INSERT 0 100
teledb=# analyze t_sex ;
ANALYZE
teledb=# explain select * from t_sex where sex ='女';
QUERY PLAN
----------------------------------------------------------------------------------
Remote Fast Query Execution (cost=0.00..0.00 rows=0 width=0)
Node/s: dn01, dn02
-> Index Scan using t_sex_sex_idx on t_sex (cost=0.42..9.30 rows=50 width=8)
Index Cond: (sex = '女'::text)
(4 rows)