Lookup with an inefficient index

Is this new index worth being created? Consider a simple query that uses it to filter out based on the value:

EXPLAIN ANALYZE SELECT count(*) FROM t WHERE v=1;
QUERY PLAN
----------
Aggregate  (cost=756.55..756.56 rows=1 width=0) (actual time=31.962..31.963 rows=1 loops=1)
       ->  Bitmap Heap Scan on t  (cost=165.01..731.79 rows=9903 width=0) (actual time=1.821..18.010 rows=10054 loops=1)
             Recheck Cond: (v = 1)
             ->  Bitmap Index Scan on i  (cost=0.00..162.53 rows=9903 width=0) (actual time=1.721..1.721 rows=10054 loops=1)
                   Index Cond: (v = 1)
     Total runtime: 32.019 ms
    
      
    
    relname        | t
    seq_scan       | 1
    seq_tup_read   | 100000
    idx_scan       | 1
    idx_tup_fetch  | 10054
    heap_blks_read | 0
    heap_blks_hit  | 886
    idx_blks_read  | 25
    idx_blks_hit ...

Get PostgreSQL 10 High Performance now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.