> [!NOTE] Index Scan > <table> > <tr> > <td width="25%"><img src="assets/ex_indexscan.png"></td> > <td>A targeted lookup that first traverses an index structure to find specific Tuple IDs (TIDs) matching the filter. It then performs random I/O to fetch those specific rows from the table heap. Efficient for high-selectivity queries where only a small percentage of the table is needed.</td> > </tr> > </table> > > ```sql > -- Point lookup by Primary Key > EXPLAIN (ANALYZE, COSTS, BUFFERS, VERBOSE) > SELECT * FROM animals WHERE id = 100; > ``` > > ![IndexScan Plan Tree](assets/plan_tree_op_index_scan.svg) > > ```text > Index Scan using animals_pkey on public.animals (cost=0.29..8.30 rows=1 width=27) (actual time=0.005..0.006 rows=1 loops=1) > Output: id, name, species_id, created_at > Index Cond: (animals.id = 100) > Buffers: shared hit=3 > Planning: > Buffers: shared hit=83 > Planning Time: 0.253 ms > Execution Time: 0.024 ms > ``` > > ![Index Scan measured plan performance signature](assets/trace_op_index_scan.svg) > > <table> > <tr> > <td rowspan="2" width="25%"><img src="assets/ex_index_scan.svg"></td> > <td><b>Performance</b></td><td>High performance for low-selectivity queries (returning few rows).</td> > </tr> > <tr><td><b>Cost</b></td><td><code>index cost + cpu_index_tuple_cost * index entries scanned</code></td></tr> > </table>