他的回复:
postgres=# explain (analyze,buffers) select * from t4 where bh2 = '652e4e0e-ba60-0400-25b5-4ee5e490fffe'; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ Streaming (type: GATHER) (cost=4.95..51.75 rows=31 width=102) (actual time=2.341..2.597 rows=32 loops=1) Node/s: All datanodes (Buffers: shared hit=1) -> Bitmap Heap Scan on t4 (cost=4.33..43.75 rows=31 width=102) (actual time=[0.044,0.044]..[0.092,0.228], rows=32) Recheck Cond: ((bh2)::text = '652e4e0e-ba60-0400-25b5-4ee5e490fffe'::text) Buffers: shared max hit=36 min hit=3 -> Bitmap Index Scan on i_t4 (cost=0.00..4.33 rows=31 width=0) (actual time=[0.038,0.038]..[0.059,0.059], rows=32) Index Cond: ((bh2)::text = '652e4e0e-ba60-0400-25b5-4ee5e490fffe'::text) Buffers: shared max hit=4 min hit=3 Total runtime: 3.091 ms (10 rows) Time: 7.289 ms postgres=# select * from pg_stat_all_indexes where relname ='t4'; relid | indexrelid | schemaname | relname | indexrelname | idx_scan | idx_tup_read | idx_tup_fetch --------+------------+------------+---------+--------------+----------+--------------+--------------- 892383 | 894076 | sa | t4 | i_t4 | 0 | 0 | 0 (1 row) Time: 5.915 ms postgres=# select schemaname,relname,seq_scan,idx_scan from pg_stat_all_tables where relname ='t4'; schemaname | relname | seq_scan | idx_scan ------------+---------+----------+---------- sa | t4 | 15 | 0 (1 row) Time: 3.736 ms