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

Data Node Scan

Description

If the GUC parameter enable_fast_query_shipping is set to on, the optimizer attempts to push down the query statement from the CN to DNs for execution, and then returns the execution result to the DNs.

Typical Scenarios

Use query statements that can be pushed down.

Examples

Queries that can be pushed down

-- Prepare data.
gaussdb=#SET enable_fast_query_shipping=on;
gaussdb=#DROP TABLE IF EXISTS t1;
gaussdb=#CREATE TABLE t1 (id int, number int, grade int);

-- Execution result.
gaussdb=#EXPLAIN SELECT *  FROM t1 where id > 1;
                    QUERY PLAN
--------------------------------------------------
 Data Node Scan  (cost=0.00..0.00 rows=0 width=0)
   Node/s: All datanodes
(2 rows)

The actual plan is generated on the DN. To view the execution plan on the DN, set the max_datanode_for_plan parameter.

-- Enable a parameter.
gaussdb=#SET max_datanode_for_plan = 1;
-- Execution result.
gaussdb=#EXPLAIN SELECT *  FROM t1 where id > 1;
                             QUERY PLAN
--------------------------------------------------------------------
 Data Node Scan  (cost=0.00..0.00 rows=0 width=0)
   Node/s: All datanodes

 Remote SQL: SELECT id, "number", grade FROM public.t1 WHERE id > 1
 Datanode Name: datanode1
   Seq Scan on t1  (cost=0.00..34.31 rows=648 width=12)
     Filter: (id > 1)
(8 rows)

-- Drop.
gaussdb=#DROP TABLE IF EXISTS t1;

Item

Description

Data Node Scan

Specifies the operator name.

Node/s: All datanodes

Delivers data to all DNs.