Updated on 2025-05-29 GMT+08:00

VALUES Scan

Description

Reads the list of values specified in the VALUES clause and returns it as a set of virtual rows to the query planner. These virtual rows can be used by other scanners or operators, such as hash join or merge join.

Typical Scenarios

This operator provides a quick and simple way to specify a set of values without reading data from a table. This is useful during testing or debugging, or when you need to insert a small amount of data.

Examples

The insert statement contains VALUES.

-- Prepare data.
gaussdb=# CREATE TABLE test_b (c1 number); 
CREATE TABLE

-- Execution result.
gaussdb=# EXPLAIN INSERT INTO test_b(c1) VALUES ('1'),('2'); 
                             QUERY PLAN                              
-------------------------------------------------------------------- 
 Insert on test_b  (cost=0.00..0.03 rows=2 width=12) 
   ->  Values Scan on "*VALUES*"  (cost=0.00..0.03 rows=2 width=12) 
(2 rows)

-- Drop the table.
gaussdb=# DROP TABLE test_b;

Item

Description

VALUES Scan

Operator name.