Updated on 2025-03-13 GMT+08:00

Remote query

Description

If an SQL statement cannot be pushed down and a distributed execution plan cannot be generated, an execution plan for sending statements is generated. Run the EXPLAIN VERBOSE command to view the SQL statements delivered to DNs.

Typical Scenarios

If an SQL statement cannot be pushed down, a distributed execution plan cannot be generated.

Examples

-- Prepare the environment.
gaussdb=# CREATE TABLE t1(c1 int,c2 int);

gaussdb=# EXPLAIN VERBOSE SELECT * FROM t1 limit 1;
                                     QUERY PLAN
------------------------------------------------------------------------------------
 Limit  (cost=0.00..0.00 rows=1 width=8)
   Output: t1.c1, t1.c2
   ->  Data Node Scan on "__REMOTE_LIMIT_QUERY__"  (cost=0.00..0.00 rows=1 width=8)
         Output: t1.c1, t1.c2
         Node/s: All datanodes
         Remote query: SELECT c1, c2 FROM ONLY public.t1 WHERE true LIMIT 1::bigint
(6 rows)

-- Drop.
gaussdb=# DROP TABLE t1;