Esta página ainda não está disponível no idioma selecionado. Estamos trabalhando para adicionar mais opções de idiomas. Agradecemos sua compreensão.

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

VACUUM FULL Is Slow

Updated on 2025-01-06 GMT+08:00

Common scenarios and troubleshooting methods for slow execution of VACUUM FULL are as follows:

Scenario 1: VACUUM FULL Is Executed Slowly Due to Lock Wait

  • If the cluster version is 8.1.x or later, perform the following steps:
  1. Query the pgxc_lock_conflicts view to check lock conflicts.

    1
    SELECT * FROM pgxc_lock_conflicts;
    

    • As shown in the following figure, if the value of granted is f, the VACUUM FULL statement is waiting for another lock. If granted is t, the INSERT statement holds the lock. nodename indicates the CN or DN where the lock is generated, for example, cn_5001. Execute 2.
    • If 0 rows is displayed in the command output, no lock conflict occurs. In this case, check other scenarios.

  2. Based on the statement content, determine whether to run VACUUM FULL immediately after terminating the lock-holding statement or run VACUUM FULL during off-peak hours.

    To terminate a lock-holding statement, run the following statement: In the preceding command, pid is obtained from step 1, and cn_5001 is the node name queried out.

    1
    execute direct on (cn_5001) 'SELECT PG_TERMINATE_BACKEND(pid)';
    

  3. After the statement is terminated, run VACUUM FULL again.

    1
    VACUUM FULL table_name;
    

  • For 8.0.x and earlier versions:
  1. Run the following statement in the database to obtain the value of query_id corresponding to the VACUUM FULL operation:

    1
    SELECT * FROM pgxc_stat_activity WHERE query LIKE '%vacuum%'AND waiting = 't'; 
    

  2. Run the following statement to check whether lock wait exists (Use the obtained query_id):

    1
    SELECT * FROM pgxc_thread_wait_status WHERE query_id = {query_id};
    

    • If acquire lock is displayed in wait_status in the command output, lock wait exists. Check the value of node_name and record it, for example, cn_5001 or dn_600x_600y, then go to 3.
    • If in the query result, wait_status does not contain acquire lock, there is no lock wait. Check other scenarios.

  3. Run the following statement to check the lock waited by the VACUUM FULL operation in pg_locks: The following uses cn_5001 as an example. If the lock wait is on a DN, change it to the corresponding DN name. pid is obtained in 2.

    Record the value of relation in the command output.

    1
    execute direct on (cn_5001) 'SELECT * FROM pg_locks WHERE pid = {tid} AND granted = ''f''';
    

  4. View in pg_locks the PID of the transaction holding the lock based on the value of relation . The value of relation is obtained in 3.

    1
    execute direct on (cn_5001) 'SELECT * FROM pg_locks WHERE relation = {relation} AND granted = ''t'''; 
    

  5. Run the following statement to query the corresponding SQL statement based on the PID: The value of pid is obtained in 4.

    1
    execute direct on (cn_5001) 'SELECT query FROM pg_stat_activity WHERE pid ={pid}';
    

  6. Based on the statement content, determine whether to run VACUUM FULL immediately after terminating the lock-holding statement or run VACUUM FULL during off-peak hours.

    To terminate a lock-holding statement, run the following statement: In the preceding command, pid is obtained from 4, and cn_5001 is the node name queried in 4.

    1
    execute direct on (cn_5001) 'SELECT PG_TERMINATE_BACKEND(pid)';
    

  7. After the statement is terminated, run the VACUUM FULL statement.

    1
    VACUUM FULL table_name;
    

Scenario 2: Transactions Cannot Be Committed Due to I/O or Network Problems

Solution: Run the CRETAE TABLE statement. If the execution is still slow, there might be issues with the I/O or network. In such cases, check the I/O and network conditions.

Scenario 3: VACUUM FULL Is Executed Slowly Due to Large System Catalogs

Once the I/O or network problems are resolved, perform a VACUUM FULL on empty tables. If the VACUUM FULL operation is still slow, even on empty tables, it indicates that the system catalogs are too large. Executing VACUUM FULL on any table requires scanning the system catalogs pg_class, pg_partition, and pg_proc. If the three system catalogs are too large, VACUUM FULL will be executed slowly.

Solution: GaussDB(DWS) supports executing VACUUM FULL on system catalogs. However, the execution holds an eight-level lock, and services related to system catalogs will be blocked. Clear system catalogs during off-peak hours or when services are stopped and no DDL operation is performed.

Scenario 4: Slow VACUUM FULL on a Column-store Table Using Partial Clustering (PCK)

When VACUUM FULL is performed on a column-store table, if PCK exists, all records in PARTIAL_CLUSTER_ROWS are loaded to the memory and then sorted. If the table is large or psort_work_mem is set to a small value, data will spill to disks during PCK sorting (the database stores temporary results to disks). This increases the time consumption.

Solution: Adjust the values of PARTIAL_CLUSTER_ROWS and psort_work_mem based on the tuple length of the data in the table.
  1. Run the following statement to view the table definition. If PARTIAL CLUSTER KEY is displayed in the command output, the table contains PCKs.
    1
    SELECT * FROM pg_get_tabledef('table name');
    

  2. Log in to the GaussDB(DWS) management console and choose Clusters on the left.
  3. Click the cluster name to go to the cluster details page.
  4. Click Parameters on the left, enter psort_work_mem in the search box, increase the values on both CNs and DNs, and click Save.
  5. Run VACUUM FULL again.

Usamos cookies para aprimorar nosso site e sua experiência. Ao continuar a navegar em nosso site, você aceita nossa política de cookies. Saiba mais

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback