Help Center> GaussDB> Distributed_2.x> Tutorial: Using GDS to Import Data from a Remote Server> Step 6: Improving Query Efficiency After Data Import
Updated on 2023-10-23 GMT+08:00

Step 6: Improving Query Efficiency After Data Import

After data is imported, run the ANALYZE statement to generate table statistics. The statistics data is useful when you run the planner, which provides you with an efficient query execution plan.

If a large number of rows were updated or deleted during import, run VACUUM FULL before ANALYZE. A large number of updates and delete operations generate huge disk page fragments, which reduces the query efficiency. VACUUM FULL can restore disk page fragments and return them to the OS.

  1. Run VACUUM FULL on the product_info table.

    1
    openGauss=# VACUUM FULL product_info;
    
    VACUUM

  2. Update statistics in the product_info table.

    1
    openGauss=# ANALYZE product_info;
    
    ANALYZE