更新时间:2025-05-29 GMT+08:00
Values Scan
算子说明
读取 VALUES 子句中指定的值列表,并将其作为一组虚拟行返回给查询计划器。这些虚拟行可以被其他扫描器或操作符使用,例如 HashJoin 或 MergeJoin。
典型场景
该算子提供了一种快速且简便的方法来指定一组值,无需从表中读取数据。这在测试或调试期间,或需要插入少量数据时非常有用。
示例
示例:插入语句中带VALUES。
--数据准备。 gaussdb=# CREATE TABLE test_b (c1 number); CREATE TABLE --执行结果。 gaussdb=# EXPLAIN INSERT INTO test_b(c1) VALUES ('1'),('2'); QUERY PLAN -------------------------------------------------------------------------------- Streaming (type: GATHER) (cost=0.12..2.21 rows=1 width=32) Node/s: All datanodes -> Insert on test_b (cost=0.00..2.11 rows=4 width=32) -> Streaming(type: REDISTRIBUTE) (cost=0.00..0.11 rows=4 width=32) Spawn on: datanode2 -> Values Scan on "*VALUES*" (cost=0.00..0.03 rows=4 width=32) (6 rows) --删除表。 gaussdb=# DROP TABLE test_b;
父主题: 表访问方式