set cpu_tuple_cost=0.01;
set cpu_index_tuple_cost = 0.005;
set cpu_operator_cost = 0.0025;
set seq_page_cost= 1.0;
set random_page_cost = 4.0;
set session enable_seqscan = off;
explain (analyze,verbose,costs,buffers,timing)select c_bh,c_xzdm,c_jgid,c_ajbm from t_test where d_slrq >='2018-03-18'
Bitmap Heap Scan on db.t_test (cost=4.17..10.31 rows=3 width=96) (actual time=0.033..0.039 rows=5 loops=1)
Output: c_bh, c_xzdm, c_jgid, c_ajbm
Recheck Cond: (t_test.d_slrq >= '2018-03-18'::date)
Heap Blocks: exact=2
Buffers: shared hit=3
-> Bitmap Index Scan on idx_ttjaj_dslrq (cost=0.00..4.17 rows=3 width=0) (actual time=0.014..0.014 rows=6 loops=1)
Index Cond: (t_test.d_slrq >= '2018-03-18'::date)
Buffers: shared hit=1
Planning time: 0.265 ms
Execution time: 0.079 ms
db_jcxx=# select relpages,reltuples from pg_class where relname ='t_test';
relpages | reltuples
----------+-----------
7 | 141
db_jcxx=# select relpages,reltuples from pg_class where relname ='idx_ttjaj_dslrq';
relpages | reltuples
----------+-----------
2 | 141
最终费用= 10.31是如何计算的? 不知道我还需要提供更多信息吗?