Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
On this page

Stream Operation Hints

Updated on 2024-08-20 GMT+08:00

Description

A method of using stream in a parallel execution plan is specified. The value can be broadcast or redistribute, indicating that data is broadcast or redistributed.

Syntax

1
[no] broadcast|redistribute|local_roundrobin( [@queryblock] table_list)

Parameters

  • For details about @queryblock, see Hint for Specifying the Query Block Where the Hint Is Located. This parameter can be omitted, indicating that it takes effect in the current query block.
  • broadcast, redistribute, and local_roundrobin indicate data distribution methods.
    • no specifies that the specified hint will not be used for a stream operation.
    • table_list specifies one or more tables on which the stream operation is performed. Multiple tables are separated by spaces. For example, broadcast(t1) and broadcast(t1 t2).

Examples

create table stream_t1(a int, b int);
insert into stream_t1 values(generate_series(1, 1000000), generate_series(1, 1000000));
analyze stream_t1;
create table stream_t2(a int, b int);
insert into stream_t2 values(generate_series(1, 10000), generate_series(1, 10000));
analyze stream_t2;
set query_dop = 4;
explain (costs off) select/*+ broadcast(stream_t1)*/ * from stream_t1 join stream_t2 on (stream_t1.a = stream_t2.a);
                          QUERY PLAN
--------------------------------------------------------------
 Streaming(type: LOCAL GATHER dop: 1/4)
   ->  Hash Join
         Hash Cond: (stream_t1.a = stream_t2.a)
         ->  Streaming(type: BROADCAST dop: 4/4)
               ->  Seq Scan on stream_t1
         ->  Hash
               ->  Streaming(type: LOCAL ROUNDROBIN dop: 4/1)
                     ->  Seq Scan on stream_t2
(8 rows)
-- Specify an execution plan to broadcast stream_t2.
explain (costs off) select/*+ broadcast(stream_t2)*/ * from stream_t1 join stream_t2 on (stream_t1.a = stream_t2.a);
                      QUERY PLAN
-------------------------------------------------------
 Streaming(type: LOCAL GATHER dop: 1/4)
   ->  Hash Join
         Hash Cond: (stream_t1.a = stream_t2.a)
         ->  Seq Scan on stream_t1
         ->  Hash
               ->  Streaming(type: BROADCAST dop: 4/1)
                     ->  Seq Scan on stream_t2
(7 rows)
-- The data of stream_t2 is broadcast and then joined with stream_t1. In this example, four concurrent requests are enabled, and a table is broadcast to other threads for parallel hash join. The size of table stream_t2 is smaller than that of table stream_t1. Therefore, broadcasting table t2 brings lower performance overhead.

-- Specify an execution plan where stream_t2 uses local_roundrobin.
SET explain_perf_mode=pretty; -- Open the explain pretty option to view a detailed plan.
EXPLAIN (costs off) SELECT/*+ local_roundrobin(stream_t2)*/ * FROM stream_t1 JOIN stream_t2 ON (stream_t1.a = stream_t2.a);
 id |                        operation                        
----+---------------------------------------------------------
  1 | ->  Streaming(type: LOCAL GATHER dop: 1/4)
  2 |    ->  Hash Join (3,5)
  3 |       ->  Streaming(type: BROADCAST dop: 4/4)
  4 |          ->  Seq Scan on stream_t1
  5 |       ->  Hash
  6 |          ->  Streaming(type: LOCAL ROUNDROBIN dop: 4/1)
  7 |             ->  Seq Scan on stream_t2
(7 rows)

 Predicate Information (identified by plan id)  
------------------------------------------------
   2 --Hash Join (3,5)
         Hash Cond: (stream_t1.a = stream_t2.a)
(2 rows)

The stream_t2 table uses the local_roundrobin data distribution method.

NOTE:

The local_roundrobin hint takes effect only when the degree of parallelism for table scanning is 1. You are advised to use this hint with scandop hint.

Stream hints take effect only when parallel execution plans are generated.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback