> **Values Scan** > <table> > <tr> > <td width="25%"><img src="assets/ex_values_scan.png"></td> > <td>Scans a set of constant values provided directly in the query (e.g., the <code>VALUES</code> clause). It treats the constant list as a virtual table, allowing it to be filtered, joined, or aggregated like any other physical relation.</td> > </tr> > </table> > > ```sql > -- Scanning a literal list of tuples > EXPLAIN (ANALYZE, COSTS, BUFFERS, VERBOSE) > VALUES (1, 'a'), (2, 'b'); > ``` > > ![ValuesScan Plan Tree](assets/plan_tree_op_values_scan.svg) > > <!-- literal-explain-plan > Captured EXPLAIN provenance for the adjacent reader-facing visual plan. > Canonical capture metadata lives in scratch/actual_operation_plans.json. > > Values Scan on "*VALUES*" (cost=0.00..0.03 rows=2 width=36) (actual time=0.009..0.010 rows=2 loops=1) > Output: column1, column2 > Planning: > Buffers: shared hit=3 > Planning Time: 0.054 ms > Execution Time: 0.038 ms > --> > > > <!-- > Raw-capture provenance — separate run. > SQL, setup, dataset, settings, and scope: artifacts/chapter4_capture_matrix.json. > Target: PostgreSQL 18.x companion fixture. Cache state: uncontrolled. > Boundary: pg_wait_tracer backend execution root; client states are included when the chart shows them. > Fidelity: exact pg_wait_tracer export. Not the adjacent EXPLAIN run; compare state shape, not durations. > --> > > ![Values Scan separate raw capture](assets/trace_op_values_scan.svg) > > <table> > <tr> > <td rowspan="2" width="25%"><img src="assets/ex_values_scan.svg"></td> > <td><b>Performance</b></td><td>High performance; the tuples are typically stored directly in the query plan and do not require heap access.</td> > </tr> > <tr><td><b>Cost</b></td><td><code>`cpu_tuple_cost * number of values`</code></td></tr> > </table>