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
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
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
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
Huawei Cloud Astro Canvas
Huawei Cloud Astro Zero
CodeArts Governance
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 (CCI)
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
Cloud Transformation
Well-Architected Framework
Cloud Adoption Framework
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
Blockchain
Blockchain Service
Web3 Node Engine Service
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Cost-based Vacuum Delay

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

This feature allows administrators to reduce the I/O impact of the VACUUM and ANALYZE statements on concurrent database activities. It is often more important to prevent maintenance statements, such as VACUUM and ANALYZE, from affecting other database operations than to run them quickly. Cost-based vacuum delay provides a way for administrators to achieve this purpose.

NOTICE:

Certain VACUUM operations hold critical locks and should be complete as quickly as possible. In GaussDB, cost-based vacuum delays do not take effect during such operations. To avoid uselessly long delays in such cases, the actual delay is the larger of the two calculated values:

  • vacuum_cost_delay x accumulated_balance/vacuum_cost_limit
  • vacuum_cost_delay x 4

Context

During the execution of the ANALYZE | ANALYSE (see "SQL Reference > SQL Syntax > A > ANALYZE | ANALYSE" in Developer Guide) and VACUUM (see "SQL Reference > SQL Syntax > V > VACUUM" in Developer Guide) statements, the system maintains an internal counter that keeps tracking the estimated cost of various I/O operations that are performed. When the accumulated cost reaches a limit (specified by vacuum_cost_limit), the thread performing the operation will sleep for a short period of time (specified by vacuum_cost_delay). Then, the counter resets and the operation continues.

By default, this feature is disabled. To enable this feature, set vacuum_cost_delay to a non-zero value.

vacuum_cost_delay

Parameter description: VACUUM starts the backend service thread to sort dead tuples in the data table, which conflicts with the service thread. If vacuum_cost_delay is set to the value of vacuum_cost_limit to control the impact of VACUUM on services, the VACUUM thread hibernates the time specified by vacuum_cost_delay and allocates resources to service threads for execution to ensure that services are not blocked by backend VACUUM.

Parameter type: integer.

Unit: ms

Value range: 0 to 100. The value 0 indicates that the cost-based vacuum delay feature is disabled, and a positive value indicates that the cost-based vacuum delay feature is enabled. In many systems, the effective resolution of the hibernation time is 10 milliseconds. Therefore, setting vacuum_cost_delay to a value that is not an integer multiple of 10 has the same effect as setting it to the next higher multiple of 10.

Default value: 0

Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.

Setting suggestion: This parameter is usually set to a small value, such as 10ms or 20ms. Adjusting vacuum's resource consumption is best done by changing other vacuum cost parameters.

Risks and impacts of improper settings: Change the parameter value after fully understanding the parameter meaning and verifying it through testing.

vacuum_cost_page_hit

Parameter description: Specifies the estimated cost for VACUUM to clean up data pages hit in a buffer.

Parameter type: integer.

Unit: none

Value range: 0 to 10000

Default value: 1

Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.

Setting suggestion: Retain the default value.

Risks and impacts of improper settings: Change the parameter value after fully understanding the parameter meaning and verifying it through testing.

vacuum_cost_page_miss

Parameter description: Specifies the estimated cost for VACUUM to clean up data pages that do not hit in a buffer.

Parameter type: integer.

Unit: none

Value range: 0 to 10000

Default value: 10

Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.

Setting suggestion: Retain the default value.

Risks and impacts of improper settings: Change the parameter value after fully understanding the parameter meaning and verifying it through testing.

vacuum_cost_page_dirty

Parameter description: Specifies the cost of VACUUM cleanup dirty pages. If the data page to be cleaned up is a clean page, VACUUM cleanup generates an extra cost of flushing dirty pages to disks. You can set this parameter to specify the cost of VACUUM cleanup dirty pages.

Parameter type: integer.

Unit: none

Value range: 0 to 10000

Default value: 20

Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.

Setting suggestion: Retain the default value.

Risks and impacts of improper settings: Change the parameter value after fully understanding the parameter meaning and verifying it through testing.

vacuum_cost_limit

Parameter description: Specifies the cost limit. The vacuum thread will hibernate if this limit is exceeded. When the execution cost of the VACUUM thread reaches vacuum_cost_limit, the thread sleeps for the time specified by vacuum_cost_delay.

Parameter type: integer.

Unit: none

Value range: 1 to 10000

Default value: 1000

Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.

Setting suggestion: Retain the default value. A larger value indicates a smaller I/O frequency limit of the VACUUM, a lower probability of entering the hibernation, more efficient VACUUM, and a greater impact on service I/Os.

Risks and impacts of improper settings: Change the parameter value after fully understanding the parameter meaning and verifying it through testing.

vacuum_defer_cleanup_age

Parameter description: Specifies the delay for the VACUUM operation to clear invalid row-store table records. The delay is calculated based on the number of executed transactions. You can set the value of vacuum_defer_cleanup_age to control the number of delayed transactions. That is, the VACUUM and VACUUM FULL operations do not clear a deleted tuple immediately. Instead, they clear and delete the tuple only after a certain number of transactions have been processed.

Parameter type: integer.

Unit: none

Value range: 0 to 1000000. 0 indicates no delay.

Default value: 0

Setting method: This is a SIGHUP parameter. Set it based on instructions provided in Table 1.

Setting suggestion: Retain the default value.

Risks and impacts of improper settings: If the value is too large, VACUUM and VACUUM FULL cannot be performed in a timely manner.

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