tencent cloud

TDSQL-C for MySQL

Release Notes and Announcements
Release Notes
Product Announcements
Beginner's Guide
Product Introduction
Overview
Strengths
Use Cases
Architecture
Product Specifications
Instance Types
Product Feature List
Database Versions
Regions and AZs
Common Concepts
Use Limits
Suggestions on Usage Specifications
Kernel Features
Kernel Overview
Kernel Version Release Notes
Optimized Kernel Version
Functionality Features
Performance Features
Security Features
Stability Feature
Analysis Engine Features
Inspection and Repair of Kernel Issues
Purchase Guide
Billing Overview
Product Pricing
Creating Cluster
Specification Adjustment Description
Renewal
Payment Overdue
Refund
Change from Pay-as-You-Go to Yearly/Monthly Subscription
Change from Pay-as-You-Go to Serverless Billing
Value-Added Services Billing Overview
Viewing Billing Statements
Getting Started
Database Audit
Overview
Viewing Audit Instance List
Enabling Audit Service
Viewing Audit Logs
Log Shipping
Post-Event Alarm Configuration
Modifying Audit Rule
Modifying Audit Service
Disabling Audit Service
Audit Rule Template
Viewing Audit Task
Authorizing Sub-User to Use Database Audit
Serverless Service
Serverless Introduction
Creating and Managing a Serverless Cluster
Elastic Scaling Management Tool
Serverless Resource Pack
Multi-AZ Deployment
Configuration Change
FAQs
Serverless Cost Estimator
Operation Guide
Operation Overview
Switching Cluster Page View in Console
Database Connection
Instance Management
Configuration Adjustment
Instance Mode Management
Cluster Management
Scaling Instance
Database Proxy
Account Management
Database Management
Database Management Tool
Parameter Configuration
Multi-AZ Deployment
GD
Backup and Restoration
Operation Log
Data Migration
Parallel Query
Columnar Storage Index (CSI)
Analysis Engine
Database Security and Encryption
Monitoring and Alarms
Basic SQL Operations
Connecting to TDSQL-C for MySQL Through SCF
Tag
Practical Tutorial
Classified Protection Practice for Database Audit of TDSQL-C for MySQL
Upgrading Database Version from MySQL 5.7 to 8.0 Through DTS
Usage Instructions for TDSQL-C MySQL
New Version of Console
Implementing Multiple RO Groups with Multiple Database Proxy Connection Addresses
Strengths of Database Proxy
Selecting Billing Mode for Storage Space
Creating Remote Disaster Recovery by DTS
Creating VPC for Cluster
Data Rollback
Solution to High CPU Utilization
How to Authorize Sub-Users to View Monitoring Data
White Paper
Security White Paper
Performance White Paper
Troubleshooting
Connection Issues
Performance Issues
API Documentation
History
Introduction
API Category
Making API Requests
Instance APIs
Multi-Availability Zone APIs
Other APIs
Audit APIs
Database Proxy APIs
Backup and Recovery APIs
Parameter Management APIs
Billing APIs
serverless APIs
Resource Package APIs
Account APIs
Performance Analysis APIs
Data Types
Error Codes
FAQs
Basic Concepts
Purchase and Billing
Compatibility and Format
Connection and Network
Features
Console Operations
Database and Table
Performance and Log
Database Audit
Between TDSQL-C for MySQL and TencentDB for MySQL
Service Agreement
Service Level Agreement
Terms of Service
TDSQL-C Policy
Privacy Policy
Data Privacy and Security Agreement
General References
Standards and Certifications
Glossary
Contact Us

HINT Statement Control

PDF
Focus Mode
Font Size
Last updated: 2023-02-23 11:00:59
TDSQL-C for MySQL allows you to enable or disable the parallel query feature by adjusting parameters. Specifically, you can enable or disable the feature for all SQL statements, set execution conditions, or specify the execution mode of a specific SQL statement through the HINT statement in the console.
Note:
The HINT statement can specify whether to execute a SQL statement and apply session parameters to the statement. In addition, it also supports querying the specified parallel table.

HINT statement usage

Feature
Command Line
Description
Enable parallel query
SELECT /*+PARALLEL(x)*/ ... FROM ...;
x indicates the parallelism for the SQL statement, which should be greater than 0.
Disable parallel query
SELECT /*+PARALLEL(x)*/ ... FROM ...;
If x is set to 0, it indicates to disable parallel query.
Specify the parallel table
You can specify the table to be included in or excluded from the parallel query execution plan in either of the following ways:
Specify the table to be included in the plan through PARALLEL. SELECT /*+PARALLEL(t)*/ ... FROM ...;
Specify the table to be excluded from the plan through NO_PARALLEL. SELECT /*+NO_PARALLEL(t)*/ ... FROM ...;
t is the table name.
Specify both the parallel table and parallelism
SELECT /*+PARALLEL(t x)*/ * ... FROM ...;
x indicates the parallelism for the SQL statement, which should be greater than 0. t is the table name.
Set the session parameter through the HINT statement, which takes effect only for the specified SQL statement
SELECT /*+SET_VAR(var=n)*/ * ... FROM ...;
var is the parallel query parameter in the session scope.

HINT statement use cases

Use case 1:select /*+PARALLEL()*/ * FROM t1,t2; Set the parallelism to the value of txsql_parallel_degree (default) for the parallel query. If a statement does not meet the parallel query execution condition, serial query will be used.
Use case 2:select /*+PARALLEL(4)*/ * FROM t1,t2; Set the parallelism of the statement to 4 regardless of the default value, i.e., txsql_parallel_degree = 4. If the statement does not meet the parallel query execution condition, serial query will be used.
Use case 3:select /*+PARALLEL(t1)*/ * FROM t1,t2; Include the t1 table in the parallel query and use the default parallelism. If t1 is smaller than the value of txsql_parallel_table_record_threshold, serial query will be used.
Use case 4:select /*+PARALLEL(t1 8)*/ * FROM t1,t2; Include the t1 table in the parallel query and set the parallelism to 8. If t1 is smaller than the value of txsql_parallel_table_record_threshold, serial query will be used.
Use case 5:select /*+NO_PARALLEL(t1)*/ * FROM t1,t2; Exclude the t1 table from the parallel query. If t1 is greater than the value of txsql_parallel_table_record_threshold, serial query will be used.
Use case 6:select /*+SET_VAR(txsql_parallel_degree=8)*/ * FROM t1,t2; Set the parallelism of the statement to 8 regardless of the default value, i.e., txsql_parallel_degree = 8.
Use case 7:select /*+SET_VAR(txsql_parallel_cost_threshold=1000)*/ * FROM t1,t2 Set txsql_parallel_cost_threshold=1000 for the statement. If its execution penalty is greater than 1000, parallel query can be used.
Use case 8:select /*+SET_VAR(txsql_optimizer_context_max_mem_size=500000)*/ * FROM t1,t2 Set txsql_optimizer_context_max_mem_size=500000 for a statement, which means to adjust the maximum memory size it can apply for in the parallel query plan environment to 500000.

References

Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback